Google interview question

OOD question and leetcode one