Pergunta de entrevista da empresa Slack

Two leetcode medium questions in 240 minutes.