Optimizing Two Sum Problem with HashMap in Python

🚀 Day 10 of #100DaysOfCode Today’s problem: Two Sum 🔢 🔍 What I learned: Brute force approach using nested loops Understanding time complexity (O(n²)) Importance of optimizing using HashMap (next step 🚀) 💡 Approach: Checked every pair of elements If their sum equals the target → return indices 📊 Result: ✅ All test cases passed (63/63) ⏱️ Runtime: 1780 ms 🧠 Learned that brute force works, but it's not efficient 🔥 Key takeaway: There’s always a better way! Next step → solve this using HashMap in O(n) Consistency is building momentum 💯 #LeetCode #DSA #CodingJourney #Day10 #Python #ProblemSolving

  • No alternative text description for this image

To view or add a comment, sign in

Explore content categories