LeetCodeAnimation icon indicating copy to clipboard operation
LeetCodeAnimation copied to clipboard

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

Open Senrian opened this issue 8 months ago • 4 comments

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.

Senrian avatar Mar 20 '26 16:03 Senrian

你好,你的来信我已收到我会尽快与你取得联系。  此信件自动发送,表示我已收到您的来信!文润个人博客天街雨站www.leewr.com

leewr avatar Mar 20 '26 16:03 leewr

邮件已收到,三日内拜读

Teemo100 avatar Mar 20 '26 16:03 Teemo100

Get it!

HongXiaoHong avatar Mar 20 '26 16:03 HongXiaoHong

       您好,您的邮件我已收到,我会尽快阅读邮件内容并及时回复您。       祝好。范韬霖

taotaobujue88 avatar Mar 20 '26 16:03 taotaobujue88