[Animated] LeetCode 424 Longest Repeating Character Replacement | Blind 75 | Sliding Window

แชร์
ฝัง
  • เผยแพร่เมื่อ 22 ม.ค. 2025

ความคิดเห็น • 6

  • @CodeInMotion-IO
    @CodeInMotion-IO  5 วันที่ผ่านมา

    Coding solution in all languages! leetcode.com/problems/longest-repeating-character-replacement/solutions/6146343/animated-video-sliding-window-template-a-yvrl/

  • @CodeInMotion-IO
    @CodeInMotion-IO  2 หลายเดือนก่อน +2

    Subscribe to see the entire blind 75 animated!

  • @kevswags
    @kevswags หลายเดือนก่อน +3

    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 😭

    • @CodeInMotion-IO
      @CodeInMotion-IO  หลายเดือนก่อน

      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!

  • @eunaosounerd1072
    @eunaosounerd1072 27 วันที่ผ่านมา

    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

    • @CodeInMotion-IO
      @CodeInMotion-IO  27 วันที่ผ่านมา

      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