Company: Goldman Sachs_15 july
Difficulty: medium
Transaction Simplification Problem Description A settlement service keeps a ledger of debts inside a group of n people, numbered 0 through n - 1 . The ledger has m entries. Entry i is debt[i] = [fromID, toID, amount] and means that person fromID owes person toID exactly amount units of money. To close the ledger, the group carries out a settlement : a list of transfers, where each transfer names a payer, a payee and a positive amount of money. A settlement clears the ledger when, for every person, the money that person receives minus the money that person pays across all transfers is exactly equal to the total the ledger says is owed to them minus the total the ledger says they owe. Return the minimum number of transfers in a settlement that clears the ledger. Function Description Complete the function getMinTransactions in the editor below. getMinTransactions has the following parameters: n : int , the number of people debt : a 2D integer array of m rows and 3 columns, the ledger Retu