Amazon interview question

Leetcode medium question Debuging assessment was also easy