is0692vs / is0692vs/settlemate

Optimize netBalances function from O(n²) to O(n) using Map for balance lookups

Open
#25 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.