← Questions

Order manager with partial cancellations and indexed queries

0
StripeCodingLast asked Mar 2026

Build an order manager driven by text commands. Create an order with an ID, a user ID, a UTC creation time and a quantity, validating each field and rejecting duplicate IDs. Cancel part of an order's quantity, any number of times, never more than remains; an order with nothing left is cancelled. Answer two queries: the IDs of active or of cancelled orders, and the IDs of orders created between two timestamps, both in creation order. Keep indexes so the queries stay fast as orders change state.

Write and test your solution herePython in your browser, the question's tests level by level, every submission kept for you.Sign in to start coding