Microsoft interview question

Two different basic leetcode questions