Bug Report for https://neetcode.io/problems/longest-repeating-substring-with-replacement
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
hint #2 is wrongly worded. we dont want to replace the most frequent characters, we want to replace the least frequent characters that is how we minimizet the number of replacements.
Hint 2
It is always optimal to replace characters with the most frequent character in the string. Why? Because using the most frequent character minimizes the number of replacements required to make all characters in the string identical. How can you find the number of replacements now?
Bug Report for https://neetcode.io/problems/longest-repeating-substring-with-replacement
Please describe the bug below and include any steps to reproduce the bug or screenshots if possible.
hint #2 is wrongly worded. we dont want to replace the most frequent characters, we want to replace the least frequent characters that is how we minimizet the number of replacements.
Hint 2
It is always optimal to replace characters with the most frequent character in the string. Why? Because using the most frequent character minimizes the number of replacements required to make all characters in the string identical. How can you find the number of replacements now?