Microsoft interview question

they asked a leetcode medium question