Leetcode problem: Implement strStr()
Here's another Leetcode problem where my solution is accepted. Sharing it here because this is a very basic example of usage of substring() and equals() method in String class.
Implement strStr(). Return the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.
Clarification: What should we return when needle is an empty string?
For the purpose of this problem, we will return 0 when needle is an empty string.