Amazon interview question

2 Leet code easy/medium questions