End of Year Sale: Use Coupon Code END2025 to Get Extra 25% Off.
balance_list.dfs(cur) to clear all balances from index cur onwards in balance_list.balance_list[cur] is 0, increment cur and call dfs(cur + 1).cur equals the length of balance_list, return 0.nxt from cur + 1 and if balance_list[nxt] has an opposite sign to balance_list[cur], attempt to transfer the debt.balance_list[cur] to balance_list[nxt], call dfs(cur + 1) and then backtrack by subtracting the transferred amount.dfs(0) as the final answer.