1.0.3 • Published 3 years ago

splitwise-js-map v1.0.3

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

Splitwise: Minimize Cash Flow Algorithm

Minimize Cash Flow among a given set of friends who have borrowed money from each other. Given a number of friends who have to give or take some amount of money from one another. Design an algorithm by which the total cash flow among all the friends is minimized.

Approach :

Greedy. Settle the debts of the people with Max and Min. Credits.

Data Structure Used :

  1. Array : To storr the final outputs.
  2. Map : To store and get remaining individual transaction amounts in O(1) time complexity.

Implementation :

Output: from, to , value

Updates :

Feel free to submit PRs for any improvements that you find.

!! HAPPY CODING !!