Amazon interview question

One easy or medium leetcode style question