Pregunta de entrevista de Microsoft

coding question similar to those on leetcode