Microsoft interview question

Look at leetcode