Amazon interview question

Leetcode question of hard difficulty