Skip to content

Instantly share code, notes, and snippets.

View berryboylb's full-sized avatar
🎯
Focusing

Daramola Olorunfemi Winner berryboylb

🎯
Focusing
View GitHub Profile
@berryboylb
berryboylb / notes.md
Created January 4, 2026 06:18
DSA Daily — Contains Duplicate (LeetCode 217)

Key Insight

Duplicates can be detected either by sorting adjacent elements or by tracking seen values using a hash map.

Trade-offs

  • Sorting avoids extra memory but mutates input
  • Hash map preserves input and gives linear time

Interview Choice

Hash map solution is preferred unless space is constrained.