is0692vs / is0692vs/settlemate
Optimize netBalances function from O(n²) to O(n) using Map for balance lookups
Open
- Dominant language
- TypeScript
- Stars
- 0
- Forks
- 0
- PR merge metrics
- No merged PRs in 30d
Description
The netBalances function currently has O(n²) complexity due to nested loops with find() operations. For typical group sizes (~10 users), this is acceptable, but could be optimized to O(n) using a Map for balance lookups.
Consider using a Map to store balances by their userFrom-userTo key for O(1) lookups, reducing overall complexity to O(n).
This was identified in Copilot AI review of PR #24.
Contributor guide
Assessment
This issue has not been assessed yet.