Amazon Interview Question

Round 1: two leet code style med level questions