Amazon interview question

Find the output of the code