Pergunta de entrevista da empresa Pinwheel (NY)

Practical coding question in the range of LC medium difficulty