← All problemsSign in

3006. Find Beautiful Indices in the Given Array I

LeetCodeTwo PointersStringBinary SearchRolling HashString MatchingHash FunctionOpen on judge ↗

You are given a 0-indexed string s, a string a, a string b, and an integer k. An index i is beautiful if: - 0 <= i <= s.length - a.length - s[i..(i + a.length - 1)] == a - There exists an index j such that: - 0 <= j <= s.length - b.length - s[j..(j + b.length - 1)] == b - |j - i| <= k Return the array that contains beautiful indices in sorted order from smallest to largest. Example 1

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start