Devin's Blog

Home

❯

Coding

❯

Find the Index of the First Occurrence in a String

Find the Index of the First Occurrence in a String

Aug 21, 20231 min read

  • idea

Related: Repeated Substring Pattern

I solved this problem using Brute Force, but the Knuth Morris Pratt Algorithm is the official way to do this problem. In fact, this problem is quite literally that problem.


References

https://leetcode.com/problems/find-the-index-of-the-first-occurrence-in-a-string/ Knuth Morris Pratt Algorithm


Graph View

Created with Quartz v4.5.0 © 2026

  • GitHub
  • Discord Community