Amazon interview question

Validate object for each key