Quant Memo
Coding/●●●●●

Aggregate partial fills per order in arrival order

Your feed reports partial fills, so one order_id can appear several times, each with the quantity filled that time. You want one row per order carrying its total filled quantity, listed in the order each id was first seen.

events = [(1,100), (2,50), (1,200), (3,75), (2,25)]
-> [(1,300), (2,75), (3,75)]

Return total quantity per id in first-seen order. Aim for O(1)O(1) per event.

Your answer

This one is open-ended. Work it through, then check your reasoning against the full solution.

More Coding questions