Yahoo interview question

design pattern