Microsoft Interview Question

leetcode medium category question should be good enough to clear the interview