Implementing strStr() function in Java with sliding window technique

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

  • graphical user interface

To view or add a comment, sign in

Explore content categories