Same doubt.

My code is like this.

(It is not a correct answer though since I only considered 2-sum situation. There should be 3-sum, 4-sum, ...)

```
class Solution(object):
def minTransfers(self, transactions):
"""
:type transactions: List[List[int]]
:rtype: int
"""
d = {}
for trans in transactions:
i, j, k = trans
d[i] = d.get(i, 0) - k
d[j] = d.get(j, 0) + k
t = []
for key in d:
if d[key] != 0:
t.append(d[key])
print (t), len(t)
res = 0
dt = {}
for x in t:
if x in dt:
print x
res += 1
if dt[x] == 1:
dt.pop(x)
else:
dt[x] -= 1
else:
dt[-x] = dt.get(-x, 0) + 1
s=0
print res, dt, len(dt)
for key in dt:
s += dt[key]
print s
res += s-1 if s else 0
return res
```

In this test case:

```
[[8,23,20],[3,24,78],[4,20,37],[0,29,66],[2,29,2],[0,20,23],[0,22,65],[5,24,34],[0,27,6],[6,21,16],[1,26,2],[4,21,73],[8,27,64],[6,27,39],[5,25,15],[5,23,28],[8,25,53],[6,27,98],[0,25,92],[5,28,91],[8,21,75],[1,25,39],[1,22,55],[1,25,14],[4,26,70],[6,29,30],[6,26,11],[1,28,68],[1,26,13],[7,21,4],[3,29,77],[0,26,93],[7,20,39],[5,22,91],[9,27,80],[1,23,71],[6,29,27],[8,26,95],[8,29,24],[7,25,70],[1,29,17],[9,29,98],[6,22,26],[1,24,74],[0,25,33],[0,24,68],[8,25,91],[8,23,36],[1,29,25],[8,27,82],[4,24,14]]
```

The remaining non-zero balances are:

```
[-446, -378, -2, -155, -194, -259, -247, -113, -540, -178, 99, 168, 237, 155, 268, 407, 284, 369, 159, 366]
```

20 elements in this list, where +155 and -155 can form a pair.

So there are 18 non-zero balances remain:

```
{-159: 1, 194: 1, 259: 1, -284: 1, -407: 1, 2: 1, -369: 1, 113: 1, 178: 1, -237: 1, -268: 1, -366: 1, 247: 1, -168: 1, 378: 1, 540: 1, -99: 1, 446: 1}
```

which can be settled in 17 times.

The total time should be 1+17=18 but the expected answer is 19.

Is there any problem? I don't think it is correct, at least in this case.