Robinhood interview question

Leetcode Medium/Hard