Search
⌘K

Leetcode 1801. Number of Orders in the Backlog

Simulate batched buy/sell order matching where each buy matches with the lowest-price sell (and each sell with the highest-price buy), allowing partial fills until no matchable prices remain. Use a min-heap for sells and a max-heap for buys to efficiently process amounts and return the total backlog size modulo 1e9+7.


Question Timeline

See when this question was last asked and where, including any notes left by other candidates.

Comments

Your account is free and you can post anonymously if you choose.