Amazon interview question

Basic fix the Bug in the code problems