Squarepoint Capital Interview Question

Leetcode easy to medium question