Amazon interview question

Round 1: two leet code style med level questions