Tap here to switch tabs
Problem
Submissions

Problem: Optimal Account Balancing

Optimal Account Balancing gives transactions showing who paid whom and how much, then asks for the minimum number of payments needed to settle every person's net debt.

Statement

Given a list of transactions, where each transaction is represented as transactions[i]=[fromi, toi, amounti]transactions[i] = [from_i,~ to_i,~amount_i], indicating that the person fromifrom_i gave amountiamount_i to the person toito_i. Return the minimum number of transactions needed to settle all debts.

Constraints:

  • 1≤1\leq transactions.length ≤10\leq10

  • transactions[i].length ==3==3

  • 0≤0 \leq fromi, toi ≤10\leq10

  • 1≤1\leq amounti ≤100\leq100

  • fromi ≠\neq toi

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Optimal Account Balancing

Optimal Account Balancing gives transactions showing who paid whom and how much, then asks for the minimum number of payments needed to settle every person's net debt.

Statement

Given a list of transactions, where each transaction is represented as transactions[i]=[fromi, toi, amounti]transactions[i] = [from_i,~ to_i,~amount_i], indicating that the person fromifrom_i gave amountiamount_i to the person toito_i. Return the minimum number of transactions needed to settle all debts.

Constraints:

  • 1≤1\leq transactions.length ≤10\leq10

  • transactions[i].length ==3==3

  • 0≤0 \leq fromi, toi ≤10\leq10

  • 1≤1\leq amounti ≤100\leq100

  • fromi ≠\neq toi