Slack Interview Question

Two leetcode medium questions in 240 minutes.