Microsoft interview question

Leetcode Easy