Group Expense Splitter
Group Expense Splitter
MediumAlgorithms50% accepted
Minimize the number of transactions needed to settle all debts in a group expense sharing scenario.
Approach
Given N people and their net balances (positive = owed money, negative = owes money), print the minimum transactions to settle all debts.
Input
3
Alice 500
Bob -200
Charlie -300
Output
["Charlie pays Alice 300","Bob pays Alice 200"]
More Algorithms problems
Browse all coding problems →solution.py
Loading editor...
Test 1
Test 2
Test 3
Press Run to test your custom input, or Submit to judge against all test cases.
Sign in to continue
Create a free account to run code, submit solutions and track progress.
- Free forever — no credit card
- 10+ languages with live execution
- Points, streaks & leaderboards