Amazon Interview Question

Find the bug in sample code