leetle

Daily challenge for 2025-05-18

138. Find the Index of the First Occurrence in a String

Write a function solve that returns the index of the first occurrence of a substring in a string, or -1 if not found.

Example:
Input: haystack="sadbutsad", needle="sad"
Output: 0

Run this challenge interactively in Python or JavaScript when the app loads.