0

I'm encountering a problem about Settling Debt that I can't fix. The problem is similar to Leetcode 465(Optimal Account Balancing).

The input format is a list of transaction (like [[1, 3, 2], [1, 4, 3], [2, 4, 2]] and that means person 3 owes person 1 2$, person 4 owes person 1 3$ and person 4 owes person 2 2$), and you need to return the minimized transactions that suffices minimum number of transaction, just as the input format ([[1, 4, 5], [2, 3, 2]]).

Since the Solutions on Leetcode only return the minimum number of transactions, which makes the problem much easier to solve.

Does anyone know the algorithm to solve this?

Here is the link to the Leetcode 465 https://leetcode.com/problems/optimal-account-balancing/description/

0 Answers0