Find the Index of the First Occurrence in a String

Solution Code

Time Complexity

O(N M)

Space Complexity

O(1)