Amazon Interview Question

Just gave the OA for now.