Pregunta de entrevista de Microsoft

medium leetcode problems, logical question