Find Valid Substrings Based on Character Frequency Constraints
You are given:
A string s of lowercase English letters.
An integer k, representing the required length of each substring.
A Map<Character, Integer> charCount, where each entry (ch, freq) specifies that character ch must appear at least freq times in a valid substring.
Your task:
Return a list of all unique substrings of length k from the string s such that:
Each character in charCount appears in the substring at least the number of times specified.
Substrings are considered unique, so repeated substrings should only appear once in the result.
without using substring and built in functions of string
Input:
s = "abacad"
k = 3
charCount = { 'a': 2, 'b': 1 }
Output:
["aba"]
Explanation: