LeetCode: Solved Contains Duplicate with HashSet

🚀 Day 2 of #100DaysOfCode Solved Contains Duplicate on LeetCode ✅ 🧠 Key takeaway: Using a HashSet helps quickly check if any element appears more than once by leveraging constant-time lookups. ⚙️ Approach: 🔹Traverse the array 🔹Add elements to a set 🔹If an element already exists → duplicate found ⏱️ Time Complexity: O(n) 📦 Space Complexity: O(n) #100DaysOfCode #LeetCode #DSA #Java #HashSet #ProblemSolving #LearningInPublic

  • graphical user interface, application

To view or add a comment, sign in

Explore content categories