Moveworks interview question

LC medium-hard, Real-world System design.