579. Find K-Length Substrings With No Repeated Characters
You are given a string s and an integer k. You need to find all the substrings of length k that do not contain any repeated characters. Return the count of all such substrings.
Example 1:
Input: s = "havefunonleetcode", k = 5
Output: 6
Explanation: There are 6 substrings they are: 'havef','avefu','vefun','efuno','etcod','tcode'.
Example 2:
Input: s = "home", k = 5
Output: 0
Explanation: Notice k can be larger than the length of s. In this case, it is not possible to find any substring.
Now Your Turn!
Pick the correct output for the given inputInput: s="takeuforward", k=3
Still unsure what the problem is asking ?
Let’s go through a few more examples, step by step, to make it clearer.
Constraints:
- 1 <= s.length <= 104
- s consists of lowercase English letters.
- 1 <= k <= 104