Amazon Interview Question

puzzle