----Back to solving and staying consistent. Solved: * Unique Email Addresses (LeetCode 929) * Approach: Used a HashSet to store normalized emails by: • Ignoring everything after ‘+’ in the local name • Removing all ‘.’ from the local name • Keeping the domain unchanged * Key Learning: String manipulation + hashing can simplify problems that look complex at first. #LeetCode #DSA #Java #ProblemSolving
Solving LeetCode 929 with HashSet and String Manipulation
More Relevant Posts
-
-----------Today Solved: * Valid Anagram (LeetCode 242) * Approach: Used a frequency array to count characters in both strings and ensured all counts return to zero. * Key Learning: Counting techniques are powerful for string problems and often give optimal `solutions. #DSA #Java #ProblemSolving
To view or add a comment, sign in
-
-
Day: 96/365 📌 LeetCode POTD: Minimum Distance to Type a Word Using Two Fingers Hard Key takeaways/Learnings from this problem: 1. This problem is a great example of DP with state as both fingers’ positions, which feels tricky at first but clicks once you model it right. 2. Key learning: instead of deciding both fingers every time, fix one and optimize the movement of the other to reduce complexity. 3. Precomputing distances between characters makes transitions much faster and keeps the code clean. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
-
🚀 Day 6 of #100DaysOfCode | Pattern: Two Pointers Today I tackled a classic Linked List problem: 👉 Remove Nth Node From End of List At first, I thought of a brute force approach: Traverse the list to find length Then remove (length - n) node ❌ Works, but requires 2 passes 💡 Then I learned the optimal approach (Two Pointers): Use fast and slow pointers Move fast n steps ahead Move both together until fast reaches end Delete the node using slow ✅ Only 1 pass ✅ Cleaner and efficient ⚠️ Mistakes I made (important learning): Forgot to use a dummy node → failed for head deletion Got confused between moving n vs n+1 steps Faced null pointer issues in edge cases 🔥 Key Takeaway: Two pointer technique is not just for arrays, it’s super powerful in Linked Lists too 📈 Progress Update: Consistency building day by day Next week: Starting a new pattern Along with revision of Two Pointers #100DaysOfCode #DSA #Java #LinkedList #CodingJourney #ProblemSolving #LearnInPublic #PatternWise
To view or add a comment, sign in
-
-
----Keeping the momentum going.---- Solved: * Length of Last Word (LeetCode 58) * Approach: Traversed the string from the end, skipped trailing spaces, and counted characters of the last word. * Key Learning: Simple problems reinforce strong fundamentals like string traversal and edge case handling. #LeetCode #DSA #Java #ProblemSolving
To view or add a comment, sign in
-
-
🔥 Day 58 of #100DaysOfCode Solved – Check Balanced String 🔍 What I did: Traversed the string and calculated the sum of digits at even and odd indices separately, then compared both sums to determine if the string is balanced. 💡 Key Learning: Practiced string traversal and indexing Improved understanding of even vs odd index logic Learned how to convert char to integer (c - '0') 🎯 Takeaway: Even simple index-based problems can strengthen your fundamentals and attention to detail. #Day58 #LeetCode #Java #ProblemSolving #CodingJourney #100DaysOfCode #DSA
To view or add a comment, sign in
-
-
🔥 Day 58/100 Today’s problem: Reverse Integer (LeetCode) 💡 What I learned: - How to reverse digits using modulo (%) and division (/) - Handling negative numbers automatically - Most important: dealing with 32-bit integer overflow without using long - Learned to check overflow before updating the result ⚡ Key Concept: Before doing "rev = rev * 10 + digit", always check: 👉 If value exceeds "Integer.MAX_VALUE" or "Integer.MIN_VALUE", return 0 🧠 Takeaway: Small problems can hide tricky edge cases. Overflow handling is the real challenge here! 💻 Language used: Java #Day58 #100DaysOfCode #Java #DSA #CodingJourney #LeetCode
To view or add a comment, sign in
-
-
Day: 95/365 📌 LeetCode POTD: Minimum Distance Between Three Equal Elements II Medium Key takeaways/Learnings from this problem: 1. This one highlights how tracking indices smartly is more important than checking all triplets brute-force. 2. Using previous occurrences helps you narrow down valid triples quickly instead of re-scanning the array. 3. Big takeaway: problems with “equal elements” often reduce to index management + pattern observation. 4. Also a good reminder that optimizing from O(n³) thinking to near O(n) comes down to storing the right info while iterating. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
-
Day: 97/365 📌 LeetCode POTD: Minimum Distance to the Target Element Easy Key takeaways/Learnings from this problem: 1. This one shows that sometimes the simplest approach—just scanning the array—is more than enough. 2. Key learning: track the minimum absolute distance on the go instead of storing unnecessary data. 3. Good reminder that not every problem needs fancy algorithms, clarity beats complexity. #POTD #365DaysOfCode #DSA #Java #ProblemSolving #LearningInPublic #Consistency 🥷
To view or add a comment, sign in
-
-
🔥 Day 61 of #100DaysOfCode Solved – Contains Duplicate II 🔍 What I did: Used a sliding window approach with a HashSet to track elements within a range of size k, checking for duplicates efficiently. 💡 Key Learning: Understood the concept of sliding window technique Learned how to use HashSet for quick duplicate checks Practiced controlling window size by removing outdated elements 🎯 Takeaway: Combining sliding window with hashing helps solve problems efficiently without extra complexity. #Day61 #LeetCode #Java #ProblemSolving #CodingJourney #100DaysOfCode #DSA
To view or add a comment, sign in
-
-
--------LeetCode Progress Update Solved: Convert a Number to Hexadecimal (405) * Problem Insight: Convert a 32-bit integer into its hexadecimal representation without using built-in conversion methods. * Approach: • Used bit manipulation (num & 15) to extract last 4 bits • Mapped values to hexadecimal characters (0-9, a-f) • Right shift (>>> 4) to process next chunk • Handled negative numbers using 2’s complement logic automatically * Key Learning: Bit manipulation makes low-level operations both efficient and elegant—especially when dealing with number systems. #LeetCode #DSA #Java #BitManipulation #ProblemSolving
To view or add a comment, sign in
-
Explore related topics
Explore content categories
- Career
- Productivity
- Finance
- Soft Skills & Emotional Intelligence
- Project Management
- Education
- Technology
- Leadership
- Ecommerce
- User Experience
- Recruitment & HR
- Customer Experience
- Real Estate
- Marketing
- Sales
- Retail & Merchandising
- Science
- Supply Chain Management
- Future Of Work
- Consulting
- Writing
- Economics
- Artificial Intelligence
- Employee Experience
- Workplace Trends
- Fundraising
- Networking
- Corporate Social Responsibility
- Negotiation
- Communication
- Engineering
- Hospitality & Tourism
- Business Strategy
- Change Management
- Organizational Culture
- Design
- Innovation
- Event Planning
- Training & Development