Amazon interview question

Leetcode questions easy med level