Merge two price ladders, summing size on equal prices
You have two order-book ladders for the same side, each a list of (price, size) sorted ascending by price with distinct prices. Merge them into one ladder sorted by price, and where both ladders quote the same price, combine them into a single level whose size is the sum.
a = [(99,10), (100,5), (101,8)]
b = [(100,7), (101,2), (102,4)]
-> [(99,10), (100,12), (101,10), (102,4)]
Target time.
Your answer
This one is open-ended. Work it through, then check your reasoning against the full solution.