Robinhood Interview Question

LC medium to hard problems