Daily Coding Update – Day 23 Today’s challenge: Find the Index of the First Occurrence in a String What I Learned How substring searching works internally Difference between brute force and optimized comparison Why avoiding unnecessary string creation improves performance Approaches Explored Brute force using substring comparison Character-by-character matching (more optimized) Learned about an advanced algorithm: KMP for interview-level optimization Key Takeaway Good developers don’t just solve problems — they analyze time complexity and optimize solutions. Every day I understand DSA a little deeper, and that confidence keeps growing. #Java #DSA #CodingJourney #ProblemSolving #DeveloperGrowth
Optimizing String Searches with Java DSA
More Relevant Posts
-
🚀 Day 8 – LeetCode Practice Today, I solved the Count and Say problem on LeetCode: 🎯 Difficulty: Easy / Medium 💻 Language Used: Java 💡 Approach: • The “count and say” sequence is built by reading off digits of the previous term — counting repeated digits then describing them. • I started from the base term "1" and iteratively built the next term by scanning the current string and describing consecutive runs of the same character. • This continues until the nth term is generated. ⏱ Complexity: • Time Complexity: O(n × k) (n = sequence length, k = average term length) • Space Complexity: O(k) 📚 Key Takeaway: This problem improved my understanding of string manipulation and iterative pattern construction. Carefully building and transforming sequences is a useful technique in many real-world problems. Consistent problem-solving practice continues to strengthen my logic and coding confidence 💪 #LeetCode #Java #DSA #Strings #ProblemSolving #Algorithms #CodingPractice #100DaysOfCode #SoftwareDeveloper
To view or add a comment, sign in
-
-
Day 80 of DSA Problem Solving Solved LeetCode 876 — Middle of the Linked List 🔥 Today’s problem was all about linked list traversal and using the two-pointer technique efficiently. 🚀 Problem Idea We are given the head of a singly linked list, and the task is to return the middle node of the linked list. If there are two middle nodes, we return the second middle node. 💡 Key Learning The main insight was: If we use two pointers, one moving 1 step at a time and the other moving 2 steps at a time, then by the time the fast pointer reaches the end of the list, the slow pointer will be standing at the middle node. So instead of counting the total number of nodes first, we can directly find the middle in just one traversal. 🧠 Concepts Practiced Two Pointer Technique Linked List Traversal Fast and Slow Pointer Single Pass Traversal Pointer Movement Logic ⏱ Time Complexity Time: O(n) Space: O(1) 📈 Real Journey Behind the Solution At first, this problem looks very basic, and the brute force idea of counting nodes and then reaching the middle can come to mind quickly. But this question teaches a much smarter and cleaner approach using slow and fast pointers. This problem helped me strengthen my understanding of linked list fundamentals and pointer movement, which are extremely important in coding interviews. Every day, I’m realizing that even easy problems can teach very powerful concepts when solved with the right approach. #Day80 #DSA #LeetCode #Java #LinkedList #TwoPointers #CodingJourney #ProblemSolving #CodingDaily
To view or add a comment, sign in
-
-
🚀 Day 29/60 — LeetCode Discipline Problem Solved: Longest Common Prefix Difficulty: Easy Today’s problem focused on identifying the longest common starting pattern across multiple strings — a classic exercise in string comparison and iteration. The approach involved checking characters position by position across all strings until a mismatch is found. This reinforces how simple iterative logic can elegantly solve problems involving multiple inputs. It’s a reminder that sometimes, clarity in approach matters more than complexity in code. 💡 Focus Areas: • Strengthened string traversal techniques • Practiced comparing multiple inputs efficiently • Improved understanding of edge cases (empty strings, mismatch handling) • Reinforced early stopping conditions for optimization • Focused on clean and readable logic ⚡ Performance Highlight: Achieved efficient runtime with minimal overhead. Finding common ground across multiple inputs is not just a coding skill — it’s a pattern recognition mindset. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #Strings #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #Consistency #TechGrowth #LearnToCode
To view or add a comment, sign in
-
-
One interesting thing I’ve noticed while doing #100DaysOfCode and solving problems on LeetCode: At first, every problem looks completely different. But after solving a few, you start realizing many of them are built on the same core patterns: • Binary Search • Two Pointers • Sliding Window • Greedy • Hashing The real challenge isn’t just coding the solution — it’s recognizing the pattern quickly. Once the pattern clicks, the problem suddenly becomes much easier. Curious to know from other developers here 👇 Which LeetCode problem or concept made an algorithmic pattern “click” for you? #100DaysOfCode #LeetCode #DSA #Algorithms #CodingJourney #ProblemSolving #Java #SoftwareEngineering #TechLearning
To view or add a comment, sign in
-
Day 51 of My 90-Day Coding Challenge Today’s focus was on recursion, and honestly — it’s not as simple as it looks. I solved Letter Combinations of a Phone Number, which seems straightforward at first, but quickly tests how well you actually understand recursive thinking. The real challenge wasn’t writing code — it was thinking in terms of: • Breaking the problem into smaller subproblems • Building combinations step by step • Managing the recursive flow correctly Key learning: Recursion is not about memorizing patterns — it’s about visualizing the decision tree and trusting the process. One mistake I noticed: If you don’t clearly understand the base case and transitions, recursion becomes confusing very fast. What improved today: • Better clarity on how combinations are formed • Stronger grip on recursion structure (index + choices) • More confidence in handling backtracking-style problems Hard truth: Recursion feels difficult because the thinking is different — not because the problem is hard. And that’s exactly why it’s important to master it. #90DaysOfCode #DSA #Java #Recursion #Backtracking #LeetCode #ProblemSolving
To view or add a comment, sign in
-
-
Day 17/30: Connecting the Dots 🧬 One of the coolest things about Day 17 is realizing that "new" problems aren't actually new—they are just familiar patterns in different clothes. The Day 17 Insight: Coding is less about memorizing solutions and more about building a library of Reusable Patterns. Once you see the structure, the syntax follows naturally. #PatternRecognition #SoftwareEngineering #Java #DSA #ProblemSolving #LeetCodeChallenge #CareerGrowth
To view or add a comment, sign in
-
-
Every problem teaches something new — today it was LeetCode 50: Pow(x, n) At first, it looked simple: just calculate power. But the real challenge was optimizing it and handling edge cases like negative powers and Integer.MIN_VALUE overflow. Learned how Binary Exponentiation can turn an O(n) solution into O(log n) — that’s the beauty of algorithms! Moments like these remind me that problem-solving is not just about writing code, but thinking deeper. #LeetCodeJourney #DSA #KeepLearning #Java #ProblemSolving
To view or add a comment, sign in
-
-
Day 48 of My 90-Day Coding Challenge Today I solved Merge Intervals, and this one was tricky until I truly visualized what was happening. At first, the logic didn’t click. But once I started thinking in terms of interval overlap on a number line, everything became much clearer. Key concepts I learned today: • Sorting based on starting index using a comparator • Understanding how sorting simplifies complex problems • Merging intervals by tracking the current start and end range The biggest realization: Without sorting, this problem is messy. With sorting, it becomes structured and manageable. Also got hands-on with: • Writing a custom comparator • Using Arrays.sort() effectively for 2D arrays Key takeaway: Some problems feel hard not because of logic, but because you’re not visualizing them correctly. Once the visualization is clear, the solution becomes almost obvious. #90DaysOfCode #DSA #Java #LeetCode #Sorting #ProblemSolving
To view or add a comment, sign in
-
-
🚀 Day 57 — LeetCode Practice Today’s problem focused on understanding array traversal and balancing sums efficiently. ✅ Problem Solved: Find the Middle Index in Array 💡 Key Learnings: • Learned how to use total sum and left sum to avoid unnecessary calculations • Understood how to derive right sum using a simple formula • Improved thinking from brute force to optimized O(n) solution • Realized the importance of clean and simple logic in interviews 🔍 Insight: Instead of recalculating sums again and again, maintaining a running left sum and using total sum makes the solution efficient and elegant. 📈 Consistency is helping me improve my problem-solving approach day by day! #Day57 #LeetCode #ProblemSolving #Java #CodingJourney #Consistency #DSA
To view or add a comment, sign in
-
-
🚀 Day 27/60 — LeetCode Discipline Problem Solved: Length of Last Word Difficulty: Easy Today’s problem looked simple, yet it emphasized a subtle but important skill — handling edge cases cleanly. The goal was to find the length of the last word in a string, ignoring any trailing spaces. Instead of splitting the string or using extra space, the solution efficiently traverses from the end, skipping unnecessary characters and counting only what truly matters. It’s a reminder that strong coding is not always about complexity — sometimes, it’s about precision and clarity in small details. 💡 Focus Areas: • Practiced string traversal from end • Improved handling of trailing spaces • Reinforced clean and efficient logic • Avoided unnecessary extra space usage • Strengthened edge-case thinking ⚡ Performance Highlight: Achieved 0 ms runtime (100% performance). Small problems, when approached with discipline, sharpen the instincts that solve big ones. #LeetCode #60DaysOfCode #100DaysOfCode #DSA #Strings #Algorithms #ProblemSolving #CodingJourney #SoftwareEngineering #Java #Developers #Consistency #TechJourney #LearnToCode
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