Amazon Interview Question

Correct some bug in the first OA, write code in second OA