My-LeetCode-Solvings

C# Code Challenges Solved on LeetCode


Project maintained by F4NT0 Hosted on GitHub Pages — Theme by mattgraham

28. Find the index of the first Ocurrence in a String

Level: Medium

Language: C#

Topic: String

Unit Tests: 28 - Testing Results


Given two strings needle and haystack, return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.

Example 1:

Example 2:

Constraints: