Fast Enterprises interview question

Easy–medium LeetCode style problem (optimized)