Amazon interview question

Write a question on your own and solve it