Medium · Strings
Find repeated substrings size K
Given an ASCII string s and a positive integer k, return, in any order, every distinct substring of length k that occurs at least twice in s (occurrences may overlap); return an empty list if there is none.
Examples
Example 1
"banana", k=3Output: ["ana"]
Example 2
"abcabc", k=2Output: ["ab", "bc"]
Rebuild it in the studio
Open every published interview problem, solution, scene, and memory room free, with no account.