Each record [from, to, amount] says that person from handed amount (a positive integer) to person to, so to owes it back. Return the smallest number of payments that settles everyone, where a payment can move any amount between any two people.
minTransfers([[0,1,10],[2,0,5]]) is 2: person 1 pays 5 to person 0 and 5 to person 2minTransfers([[0,1,10],[1,0,1],[1,2,5],[2,0,5]]) is 1- People can be numbers or strings, and a record from a person to themselves changes nothing
- At most about 12 people end up with a non-zero balance, so an exponential search is acceptable