Search
⌘K
Get Premium
Leetcode 3008. Find Beautiful Indices in the Given Array II
Find all start indices i where substring a occurs in s and there exists a start j where substring b occurs with |j − i| ≤ k. With s up to 5e5, this requires finding all occurrences of a and b (e.g., linear scan/KMP) and then checking proximity efficiently (two-pointer, binary search, or prefix array).
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.