-----------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
Java Solution for Valid Anagram LeetCode Problem
More Relevant Posts
-
Day 76/365 — Binary Search. 😅 Implemented it both iteratively and recursively. Mistakes I made along the way: → nums.length instead of nums.length - 1 (hello, ArrayIndexOutOfBounds 👋) → mid calculated outside the loop never updated, looped forever → Compared m == target instead of nums[m] == target index vs value, classic trap Fixed them one by one. Each bug made the concept stick harder than any tutorial ever could. That's the thing about debugging it's not wasted time. It's the actual learning. 76 down. 289 to go. 🔍 #DSA #BinarySearch #365DaysOfDSA #Java #CodingJourney
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
-
-
----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
To view or add a comment, sign in
-
-
Day 72 of #100DaysOfLeetCode 💻✅ Solved #3866 “First Unique Even Element” problem in Java. Approach: • Traversed the array to find even numbers • For each even number, counted its occurrences in the array • If the count is exactly 1, returned that number • Continued until the first unique even number is found • Returned -1 if no such number exists Performance: ✓ Runtime: 1 ms (Beats 99.36% submissions) 🚀 ✓ Memory: 45.15 MB (Beats 98.39% submissions) Key Learning: ✓ Practiced combining conditions (even + uniqueness) ✓ Improved understanding of nested loop logic ✓ Learned how to filter and validate elements efficiently Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 78 of #100DaysOfLeetCode 💻✅ Solved #299. Bulls and Cows problem in Java. Approach: • Used a frequency array to track digits • Counted bulls when characters matched directly • Used count array to efficiently track cows • Updated counts to handle unmatched digits Performance: ✓ Runtime: 3 ms (Beats 95.59% submissions) 🚀 ✓ Memory: 43.64 MB (Beats 52.40% submissions) Key Learning: ✓ Learned efficient use of frequency arrays ✓ Improved handling of strings with counting logic ✓ Strengthened understanding of bulls vs cows logic Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
🚀 Day 72/100 Today’s problem: Reverse Words in a String 🧠 Problem Summary: Given a sentence, reverse each word individually while keeping the word order and spaces unchanged. 💡 Approach: - Split the string into words - Reverse each word using "StringBuilder" - Join them back with spaces ⚡ Key Learning: Improved my understanding of string manipulation and how to efficiently handle word-based transformations in Java. 💻 Code Concept: Used "StringBuilder.reverse()" for optimal performance. 📌 Example: Input: ""Let's take LeetCode contest"" Output: ""s'teL ekat edoCteeL tsetnoc"" Consistency is the key 🔑 — small progress every day leads to big results. #Day72 #DSA #Java #CodingJourney #Consistency #Learning #100DaysOfCode
To view or add a comment, sign in
-
-
Day 88 of #100DaysOfLeetCode 💻✅ Solved #56. Merge Intervals problem in Java. Approach: • Sorted intervals based on start time • Compared current interval with last merged interval • Merged overlapping intervals • Added non-overlapping intervals directly Performance: ✓ Runtime: 8 ms (Beats 91.28% submissions) 🚀 ✓ Memory: 49.16 MB (Beats 43.60% submissions) Key Learning: ✓ Learned interval merging technique ✓ Strengthened sorting + traversal logic ✓ Improved handling of overlapping ranges Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #Sorting #ProblemSolving #CodingJourney #100DaysOfCode
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
-
-
DSA Practice Update Today I solved: #876 – Middle of the Linked List Learned how to efficiently find the middle node of a linked list using the fast and slow pointer approach. Understood how moving one pointer twice as fast as the other helps identify the middle element in a single traversal. Key Learnings: • Fast and slow pointer technique • Efficient traversal of linked lists • Solving problems in O(n) time with constant space This problem strengthened my understanding of pointer-based techniques, which are very useful in linked list problems. Continuing to stay consistent and improve problem-solving skills step by step. #DSA #LeetCode #CodingJourney #Java #SoftwareDevelopment #PlacementPreparation
To view or add a comment, sign in
-
-
🚀 Day 61/100 Today’s problem: Check Balanced String 📌 Problem Summary: A string is called balanced if the sum of digits at even indices is equal to the sum at odd indices. 💡 What I learned: - How to handle index-based logic - Difference between even & odd indexing - Clean iteration and condition checking 🧠 Approach: - Traverse the string - Maintain two sums → even index & odd index - Compare both sums ⚡ Time Complexity: O(n) ⚡ Space Complexity: O(1) Consistency is the key — small steps every day lead to big results 💪 #Day61 #CodingJourney #Java #DSA #ProblemSolving #Consistency #KeepLearning #100DaysOfCode
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