Moveworks Interview Question

LC medium-hard, Real-world System design.