Amazon interview question

2 easy / medium leetcode problems