sameer khan’s Post

DSA Day 4 – Simple Problem, Important Insight Today I solved the “Contains Duplicate” problem on LeetCode. Problem: Check if any element appears more than once in an array. Initial Thought: -> Use nested loops to compare every pair -> Time Complexity: O(n²) ❌ Optimized Approach: -> Used HashMap to track elements -> While iterating, check if element already exists -> If yes → duplicate found Time Complexity: -> O(n) -> Space Complexity: O(n) Key Learning: -> Not every problem needs complex logic -> Choosing the right data structure makes a big difference -> Hashing is one of the most powerful tools in DSA What I Realized: Sometimes the simplest problems teach the most important concepts. Thanks to Pulkit Aggarwal sir for guiding me in DSA and helping me build strong fundamentals. Staying consistent, one day at a time. #DSA #LeetCode #Java #ProblemSolving #CodingJourney #100DaysOfCode

  • graphical user interface, text

To view or add a comment, sign in

Explore content categories