Chatham Financial Interview Question

Medium leetcode problem in coding assessments.