Day 79 of #100DaysOfLeetCode 💻✅ Solved #3. Longest Substring Without Repeating Characters problem in Java. Approach: • Used Sliding Window with HashSet • Expanded window using right pointer • Shrunk window when duplicate found • Tracked maximum substring length Performance: ✓ Runtime: 6 ms (Beats 69.53% submissions) 🚀 ✓ Memory: 46.46 MB (Beats 41.45% submissions) Key Learning: ✓ Strengthened Sliding Window technique ✓ Learned efficient duplicate handling using HashSet ✓ Improved substring optimization skills Learning one problem every single day 🚀 #Java #LeetCode #DSA #SlidingWindow #Strings #ProblemSolving #CodingJourney #100DaysOfCode
Solved LeetCode Longest Substring Without Repeating Characters in Java
More Relevant Posts
-
Day 85 of #100DaysOfLeetCode 💻✅ Solved #76. Minimum Window Substring problem in Java. Approach: * Used Sliding Window with character frequency array * Tracked required characters to match target string * Expanded window and reduced requirement count * Shrunk window to find minimum valid substring Performance: ✓ Runtime: 2 ms (Beats 99.94% submissions) 🚀 ✓ Memory: 45.51 MB (Beats 80.16% submissions) Key Learning: ✓ Mastered advanced Sliding Window technique ✓ Learned optimal substring minimization strategy ✓ Improved handling of variable window constraints Learning one problem every single day 🚀 #Java #LeetCode #DSA #SlidingWindow #Strings #HashMap #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 84 of #100DaysOfLeetCode 💻✅ Solved #567. Permutation in String problem in Java. Approach: * Used Sliding Window with frequency array * Decreased count for incoming characters * Adjusted window when count became invalid * Checked window size equal to s1 length Performance: ✓ Runtime: 6 ms (Beats 87.55% submissions) 🚀 ✓ Memory: 43.26 MB (Beats 99.80% submissions) Key Learning: ✓ Strengthened Sliding Window with frequency tracking ✓ Learned efficient permutation checking ✓ Improved handling of dynamic window adjustment Learning one problem every single day 🚀 #Java #LeetCode #DSA #SlidingWindow #Strings #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 87 of #100DaysOfLeetCode 💻✅ Solved #334. Increasing Triplet Subsequence problem in Java. Approach: • Used Greedy approach with two variables • Tracked smallest and second smallest values • Updated values while traversing array • Returned true when a valid triplet was found Performance: ✓ Runtime: 2 ms (Beats 99.30% submissions) 🚀 ✓ Memory: 122.40 MB (Beats 80.69% submissions) Key Learning: ✓ Learned efficient Greedy strategy for subsequences ✓ Improved tracking of minimum values dynamically ✓ Strengthened understanding of pattern detection in arrays Learning one problem every single day 🚀 #Java #LeetCode #DSA #Greedy #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 21 of #100DaysOfCode Today, I worked on the classic string problem: implementing the strStr() function in Java. The goal: Find the first occurrence of a substring (needle) inside another string (haystack). Approach I used: - Applied a sliding window technique - Compared substrings using "substring(i, j)" - Returned the starting index when a match is found Key learning: Understanding how index-based string operations work and how "substring()" helps in breaking down problems step-by-step. Also realized the importance of optimizing solutions to avoid unnecessary string creation. Consistency is slowly turning concepts into confidence! Looking forward to improving this further with more optimized approaches #Java #Coding #DSA #LeetCode #ProblemSolving #LearningJourney #Consistency
To view or add a comment, sign in
-
-
Day 90 of #100DaysOfLeetCode 💻✅ Solved #42. Trapping Rain Water problem in Java. Approach: • Used Two Pointer technique • Maintained leftMax and rightMax boundaries • Calculated trapped water based on smaller side • Accumulated water while traversing Performance: ✓ Runtime: 0 ms (Beats 100.00% submissions) 🚀 ✓ Memory: 47.70 MB (Beats 72.36% submissions) Key Learning: ✓ Mastered Two Pointer approach for complex problems ✓ Learned optimal water trapping strategy ✓ Improved understanding of boundary-based calculations Learning one problem every single day 🚀 #Java #LeetCode #DSA #TwoPointers #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 86 of #100DaysOfLeetCode 💻✅ Solved #238. Product of Array Except Self problem in Java. Approach: • Calculated prefix (left) products • Traversed from right to maintain suffix product • Combined both without using extra space • Avoided division for optimal solution Performance: ✓ Runtime: 2 ms (Beats 95.11% submissions) 🚀 ✓ Memory: 72.10 MB (Beats 31.81% submissions) Key Learning: ✓ Learned prefix and suffix product technique ✓ Improved space optimization skills ✓ Understood how to avoid division in array problems Learning one problem every single day 🚀 #Java #LeetCode #DSA #Arrays #PrefixSum #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Leetcode Question Number 1848: Minimum Distance to the Target Element. I solved an interesting problem on finding the minimum distance in an array using Java!(Leetcode Daily Challenge) Given an array, a target value, and a starting index, the task is to find the minimum distance between the start index and any occurrence of the target element. Approach I used: 1.Traverse the array 2.Check for target element 3.Calculate distance using Math.abs(start - i) 4.Track minimum using Math.min() #Leetcode #DSA #Leetcode1848 #Java #Leetcodedailychallenge
To view or add a comment, sign in
-
-
Day 63 of #100DaysOfLeetCode 💻✅ Solved #2085. Count Common Words With One Occurrence problem in Java. Approach: • Iterated through each word in the first array • Avoided duplicate checks by ensuring each word is processed only once • Counted occurrences of the current word in both arrays • If the word appears exactly once in both arrays, incremented the result • Returned the final count Performance: ✓ Runtime: 88 ms (Beats 7.45% submissions) ✓ Memory: 46.06 MB (Beats 93.07% submissions) Key Learning: ✓ Practiced handling duplicates and frequency counting ✓ Improved understanding of string comparison in arrays ✓ Learned importance of optimizing nested loop solutions Learning one problem every single day 🚀 #Java #LeetCode #DSA #Strings #Arrays #ProblemSolving #CodingJourney #100DaysOfCode
To view or add a comment, sign in
-
-
Day 93 - LeetCode Journey Solved LeetCode 9: Palindrome Number in Java ✅ At first glance, it feels like a string problem… but the real challenge is solving it without converting to string. Instead of reversing the whole number, I reversed only half of it and compared both parts. This avoids overflow and keeps it efficient. Smart approach > brute force 💡 Key takeaways: • Handling edge cases (negative numbers, trailing zeroes) • Reversing only half of the number • Avoiding extra space (no string conversion) • Writing optimized mathematical logic ✅ All test cases passed ⚡ O(log n) time and O(1) space Sometimes the best solutions are the simplest ones, just a different way of thinking 🔥 #LeetCode #DSA #Java #Math #ProblemSolving #CodingJourney #InterviewPrep #Consistency #100DaysOfCode
To view or add a comment, sign in
-
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