Coding solution in all languages! leetcode.com/problems/longest-repeating-character-replacement/solutions/6146343/animated-video-sliding-window-template-a-yvrl/
Totally get your frustration! Before you start any problem always think of the Leetcode pattern to use. I recently uploaded a video and blog for all leetcode patterns you need to know. In this case, you must use the sliding window technique. Then, it comes down to what condition you need to check to expand/shrink the window. See my generic coding templates for the sliding window www.blog.codeinmotion.io/i/151790118/coding-templates. Once you realize this pattern, you would think how to come up with a condition that can tell you if your current substring is valid. The rest is boilerplate!
I MUST be a monkey here. The problem states "You can choose any character of the string and change it to any other uppercase English character." but you didn't change it with any character at all. If I get this problem statement in an interview I'd never, ever, ever have thought that I wouldn't have to swap any position of the string with any other letter from A-Z. I understand your solution but this problem statement is very confusing with the ask
It's definitely tricky! You want to focus on realizing this is a sliding window pattern due to finding the "max substring" and then figure out the condition to use within the window. I have a video about these patterns you should check out and more content to recognize leetcode patterns
Coding solution in all languages! leetcode.com/problems/longest-repeating-character-replacement/solutions/6146343/animated-video-sliding-window-template-a-yvrl/
Subscribe to see the entire blind 75 animated!
I mean it makes sense and you explained it very well but like... how the hell can I come up with that when someone is watching me think 😭
Totally get your frustration! Before you start any problem always think of the Leetcode pattern to use. I recently uploaded a video and blog for all leetcode patterns you need to know. In this case, you must use the sliding window technique. Then, it comes down to what condition you need to check to expand/shrink the window. See my generic coding templates for the sliding window www.blog.codeinmotion.io/i/151790118/coding-templates. Once you realize this pattern, you would think how to come up with a condition that can tell you if your current substring is valid. The rest is boilerplate!
I MUST be a monkey here. The problem states "You can choose any character of the string and change it to any other uppercase English character." but you didn't change it with any character at all. If I get this problem statement in an interview I'd never, ever, ever have thought that I wouldn't have to swap any position of the string with any other letter from A-Z.
I understand your solution but this problem statement is very confusing with the ask
It's definitely tricky! You want to focus on realizing this is a sliding window pattern due to finding the "max substring" and then figure out the condition to use within the window. I have a video about these patterns you should check out and more content to recognize leetcode patterns