2539. Count the Number of Good Subsequences
Hash TableMathStringCombinatoricsCounting
Hints
Hint 1
Use the frequency array of characters of the string.
Hint 2
For 1 ≤ m ≤ s.length, count the number of subsequences of s where each character occurs exactly m times.
Hint 3
For any n and k, you can calculate (n choose k) mod p in O(log p) using binary exponentiation.
Preparing judge…