arrow_back Back to Challenges

#28 Find the Index of the First Occurrence in a String

Easy Acceptance 0%
description

Problem Description

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

checklist Constraints

See problem description for detailed constraints.

science Examples

Case #1

In: # See problem description for input format
Out: # Expected output

Mastery Tags

Strings Two Pointers

Hiring Companies

Goldman Sachs Netflix
code

Integrated IDE

code_blocks
Coding
psychology
Aptitude