3008. Find Beautiful Indices in the Given Array II
You are given a 0-indexed string
s
, a stringa
, a stringb
, and an integerk
.An index
i
is beautiful if:
0 <= i <= s.length - a.length
s[i..(i + a.length - 1)] == a
There exists an index
plaintext
1 jsuch 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.
c++
1 |
|