You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On page 97 in the book, an error is pointed out for an initial attempt at a solution, in that it doesn't track the highest_freq variable correctly as it runs and shrinks the window.
The solution given, which slides the window instead of shrinking in however, also has this problem if run with the parameters as:
longest_uniform_substring_after_replacements("aabcdeca", 2)
(whereas the book's test string is "aabcdcca")
Once the sliding window is on substring "abcde", the highest_freq value in the while loop is still 2 (which is incorrect).
(The overall function still seems to return the correct max_len value in this case, however.)