Uber interview question

2 easy/medium coding questions on leetcode