G-Research interview question

The coding interview was a hackerrank/leetcode type of problem.