Amazon interview question

Technical Interview: Medium-hard leetcode questions