Pregunta de entrevista de Autodesk

solve 1 leetcode medium level question