Approach hintTry it first, then revealHide
From each start index, extend the substring character by character through a trie and stop once the bad-letter count exceeds k. Every newly created node is one new distinct good substring. O(n^2).
From each start index, extend the substring character by character through a trie and stop once the bad-letter count exceeds k. Every newly created node is one new distinct good substring. O(n^2).