Amazon Interview Question

Debug, Logic, and algorithms.