DSA Advanced Problems

Find the Index of the First Occurrence in a String

Given strings text and pattern, return the starting index of the pattern's first occurrence in the text, or -1 if it does not occur.