first and second. Every entry is a pair [code, qty]: an item code and how many units of it sit in that warehouse. Codes never repeat within one list, but the same item can be stocked in both warehouses.
Build a combined report: for every code that appears in at least one warehouse, return the pair [code, total], where total is the quantity across both warehouses. Sort the pairs by code in ascending order.first=[[7, 2], [3, 10]], second=[[3, 5], [12, 1], [7, 4]] → [[3, 15], [7, 6], [12, 1]]
Item 3 is in both warehouses: 10 + 5 = 15. Item 7: 2 + 4 = 6. Item 12 is only in the second one. Codes go in ascending order.
first=[[5, 9]], second=[[2, 9]] → [[2, 9], [5, 9]]
No item is shared, so the lists are just joined and sorted by code.
first=[[1, 1], [2, 2]], second=[[2, 3], [1, 4]] → [[1, 5], [2, 5]]
[code, qty]first, and within secondfirst=[[7, 2], [3, 10]], second=[[3, 5], [12, 1], [7, 4]]
[[3, 15], [7, 6], [12, 1]]
Run checks the first 3 tests in your browser. Submit checks all 98 tests on the server, hidden ones included.