PEAK6 interview question

Question that was around a leetcode medium difficulty