Spire Trading Interview Question

Leetcode data structure question