Skip to content

Optimize Double.countPairs using frequency map#136

Open
alexstaicu35 wants to merge 1 commit into
mainfrom
perf-countpairs-frequency-map
Open

Optimize Double.countPairs using frequency map#136
alexstaicu35 wants to merge 1 commit into
mainfrom
perf-countpairs-frequency-map

Conversation

@alexstaicu35
Copy link
Copy Markdown

Summary

Optimize Double.countPairs by replacing nested loops with a frequency map, reducing complexity from O(n^2) to O(n) while preserving behavior (count distinct values occurring exactly twice).

Changes

  • Replace nested loops with HashMap-based frequency counting
  • Return direct count of entries with frequency == 2 (remove divide-by-2)
  • Add java.util.Map and java.util.HashMap imports

changeset_id: 1ac36dab-f26a-42ea-b9ee-a509f932bce3

Trigger Artemis Fix Agent to iterate on comments left on your PR

  1. Wait until your reviewers are done leaving comments on the PR.
  2. Tag @artemis-fix-agent in a new comment — this will be your trigger comment. Optionally, add further instructions you want Artemis to act on.

Example trigger comment:

@artemis-fix-agent address all the review feedback above.

Artemis will pick up all existing PR comments automatically. Note that each time you tag @artemis-fix-agent, a separate, parallel fix attempt will be kicked off, so only tag Artemis once you're ready to start.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants