Pergunta de entrevista da empresa Zoom Communications

Typical leet code medium question.