Thomson Reuters interview question

leetcode medium with one of their software developers