New York Times Interview Question

A simple coding exercise, sub-easy Leetcode difficulty