Amazon interview question

Debug questions Leetcoding medium and hard for part 2