Amazon interview question

Principle questions with star methods