A quantitative asset allocation engine at Citadel manages capital across distinct asset classes indexed from to . Initially, each asset class holds an allocation balance of .
The fund receives a batch of bulk allocation rebalancing orders. Each order is specified as a 3-tuple , representing an instruction to inject dollars of capital into every asset class in the contiguous index range inclusive ().
Your Task
Implement the function max_portfolio_balance(n: int, updates: list[list[int]]) -> int that determines the maximum capital balance allocated to any single asset class after all rebalancing instructions have been executed.
Constraints
Examples
n = 5
updates = [[1, 2, 100], [2, 5, 100], [3, 4, 100]]
# Asset balances after updates: [100, 200, 200, 200, 100]
# Output: 200