Inside the if statement that checks whether we have too many letters compared to k, do we really need to decrement the count of the letter at the start of the window?
This:
if (window_end - window_start + 1 - max_repeat_letter_count) > k:
left_char = str1[window_start]
frequency_map[left_char] -= 1
window_start += 1
could just be this:
if (window_end - window_start + 1 - max_repeat_letter_count) > k:
window_start += 1
Am I missing something? TIA