Pregunta de entrevista de Microsoft

Some leetcode style question, dont remember anymore