Upstart Interview Question

LeetCode easy to medium problem