Robinhood Interview Question

Typical leetcode question with two steps