Substring Pattern Matches
Asked at Apple · Coding & Leetcode-style Questions · Difficulty: Medium · Last asked May 3, 2026
Given a string `s` and a non-empty pattern `pattern`, return **every starting index** `i` in `s` where the substring `s[i..i + pattern.length - 1]` equals `pattern`.
Loading the problem…
More Apple interview questions
- LLM conceptual questions
- Implement a Two-Hidden-Layer MLP with Backpropagation in NumPy
- Compare PPO, DPO, and GRPO
- Implement a Vision Transformer (ViT) from Scratch
- Sample from a Gaussian Distribution Using Only Uniform Sampling
- ML Fundamentals and Model Debugging Rapid-Fire