Pregunta de entrevista de Grid Dynamics

it was leetcode mid problems