Amazon interview question

OOD Questions and leetcode hard 2