Algorithm · Pinterest · Hard
Build the debt-settlement feature of an expense-sharing app in the style of Splitwise. You receive an array balances in which entry i is the net balance of person i: When balances[i] > 0, person i is owed that amount and should receive it. When balances[i] The original post names these two parts but does not spell out the full input format or constraints of the problem it links to. The net-balance array, the person indexing, and the input/output format described here are…