leetle

Daily challenge for 2025-07-15

196. Find Index of Substring

Write a function solve that takes a string text and a substring pattern and returns the index of the first occurrence of the pattern in the text. Return -1 if the pattern is not found.

Example:
Input: text = "hello world", pattern = "wor"
Output: 6

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