Robinhood interview question

Leetcode medium