One Line JavaScript Solution

  • 0
    var strStr = function(haystack, needle) {
        return haystack.indexOf(needle);

    This will return the index of the first match case otherwise will return a -1 if no matches are found.

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.