Tag: longestrepeatingcharacterreplacement
-
Data Structures & Algorithms in Java – Strings – Longest Repeating Character Replacement
Problem: Given a string and a number k find the longest substring whose characters can be replaced by the most repeating character to a maximum of k times. Example: Given string = “ABAB” and k = 2 You can replace the substring “ABAB” with “BBBB” since the two A’s are not the most repeating character…