Robinhood Interview Question

Data Structures and Algorithm question