Amazon Interview Question

Find the output of the code