Skip to content

Fix #134: Use HashMap O(n) approach for C/Java/Python code#152

Open
Senrian wants to merge 2 commits intoMisterBooo:masterfrom
Senrian:master
Open

Fix #134: Use HashMap O(n) approach for C/Java/Python code#152
Senrian wants to merge 2 commits intoMisterBooo:masterfrom
Senrian:master

Conversation

@Senrian
Copy link
Copy Markdown

@Senrian Senrian commented Mar 20, 2026

Fix for Issue #134

Problem: The article claims time complexity O(n) (HashMap approach) but the C, Java, and Python implementations use nested loops O(n²).

Solution: Updated all three code implementations to use the HashMap/HashTable approach matching the documented O(n) time complexity.

Changes:

  • C: Replaced nested loop with int array as hashmap
  • Java: Replaced nested loop with HashMap solution
  • Python: Replaced nested loop with dict solution

All implementations now correctly achieve O(n) time complexity as documented in the article.

@leewr
Copy link
Copy Markdown

leewr commented Mar 20, 2026 via email

@Teemo100
Copy link
Copy Markdown

Teemo100 commented Mar 20, 2026 via email

@HongXiaoHong
Copy link
Copy Markdown

HongXiaoHong commented Mar 20, 2026 via email

@taotaobujue88
Copy link
Copy Markdown

taotaobujue88 commented Mar 20, 2026 via email

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.

5 participants