Pregunta de entrevista de Microsoft

I was asked medium Leetcode algorithms