Sliding Window Maximum || Maximum of all subarrays of size k

แชร์
ฝัง
  • เผยแพร่เมื่อ 19 ก.ย. 2024

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

  • @manaskhare412
    @manaskhare412 2 ปีที่แล้ว +7

    I have seen striver video solution as well, but this explanation tells us the intuition, which is rarely seen in any youtube videos. Hats off to you.

  • @raju_bugude
    @raju_bugude 2 ปีที่แล้ว +5

    Best Explanation(from introducing new data structure)

  • @mahadishakkhor123
    @mahadishakkhor123 5 หลายเดือนก่อน +1

    Better then all other explanation on youtube , that i seen sofar

  • @rajukachori9536
    @rajukachori9536 2 หลายเดือนก่อน

    maam is the best ....watch 5-6 video but didnt get this type of explainaion and so slowly and calm every step ...thankyou

  • @VikashKumar-ui1hs
    @VikashKumar-ui1hs 10 หลายเดือนก่อน +1

    Nice explanation, clear visual representations, and impressive coding skills. Much appreciated! Thanks:)

  • @nileshmishra5482
    @nileshmishra5482 2 หลายเดือนก่อน

    In beginning of video I got the vibe that this is the best explanation.. 💯💯💯

  • @manishkumar-qn6lx
    @manishkumar-qn6lx ปีที่แล้ว +1

    Got it. Thanks for this video and for putting so much effort into explaining the answer using an interactive board. It's worth it!!

  • @madanmohanpachouly6135
    @madanmohanpachouly6135 2 ปีที่แล้ว +1

    I tried many videos to understand, but this helped me finally, thanks for ur efforts .

  • @RishuSingh-d3b
    @RishuSingh-d3b 3 หลายเดือนก่อน

    This is the real gem of TH-cam❤❤❤❤

  • @saiyamarora4241
    @saiyamarora4241 2 หลายเดือนก่อน

    Great video and visual representation

  • @gitanjalikumari9262
    @gitanjalikumari9262 ปีที่แล้ว +1

    One of the best explanation.. thankyou so much😊

  • @ShubhamSingh-iq5kj
    @ShubhamSingh-iq5kj ปีที่แล้ว +1

    Great explanation . I always wanted someone to explain algo steps while coding also thanks again 🙏🙏

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

    Best Explanation so far for this problem :)

  • @huzaifaansari6195
    @huzaifaansari6195 ปีที่แล้ว

    best explanation.came here after watching 2 3 videos for the same question. Thanks for the video!

  • @56sanjivanisingh58
    @56sanjivanisingh58 3 ปีที่แล้ว +1

    like srrly i have visited the websites and YT video but not understanding at the last by ur video i have understood thankkkkkkkkk youuuuuuuuu

  • @manavarora2257
    @manavarora2257 6 หลายเดือนก่อน +1

    Very nice explanation..

  • @SirAkPandey
    @SirAkPandey ปีที่แล้ว

    you're the best. You always provide the best explanation 🙏🙏

  • @durgeshkushwaha2534
    @durgeshkushwaha2534 ปีที่แล้ว +1

    Really very good explanation .thank you so much❤❤

  • @vamshireddy171
    @vamshireddy171 หลายเดือนก่อน

    much better explanation than striver

  • @IgniteYoutheEngineer
    @IgniteYoutheEngineer 5 หลายเดือนก่อน

    Seen 3 explanation and this better than all

  • @akicr7
    @akicr7 11 หลายเดือนก่อน

    One of the best explanation.

  • @potlurisairaj6669
    @potlurisairaj6669 ปีที่แล้ว

    after seeing your explanation understood something thank you

  • @aaravanand2325
    @aaravanand2325 2 หลายเดือนก่อน

    Best of whole youtube

  • @nimeshpareek953
    @nimeshpareek953 ปีที่แล้ว +1

    you deserve a like I was not able to understand this saw adiitya verma video twice

  • @mdalmashalam885
    @mdalmashalam885 4 วันที่ผ่านมา

    Thanks a lot for the intuition

  • @omorfarouk5262
    @omorfarouk5262 ปีที่แล้ว

    maam you are best. Thank you for your effort.

  • @prateekkanaujia7341
    @prateekkanaujia7341 ปีที่แล้ว

    Thank you for this great explanation :)

  • @deveshgupta4689
    @deveshgupta4689 2 ปีที่แล้ว +1

    Amazing explanation!!

  • @jayeshchaurasiya262
    @jayeshchaurasiya262 3 ปีที่แล้ว +1

    Great explanation ❣️

  • @pooja8116
    @pooja8116 ปีที่แล้ว

    Best Explaination :)

  • @drizzle01
    @drizzle01 ปีที่แล้ว

    thanks! nicely explained!

  • @vinamrasangal8436
    @vinamrasangal8436 8 หลายเดือนก่อน

    grt, grt, grt
    grt=great !

  • @NatureLover-oq6uc
    @NatureLover-oq6uc ปีที่แล้ว

    veery well explained...

  • @gigachad2419
    @gigachad2419 2 ปีที่แล้ว +1

    3:56 how can we use Linked List Data Structure here?

  • @mdimranhosen6674
    @mdimranhosen6674 2 ปีที่แล้ว

    Great explanation💖

  • @codingwithanonymous890
    @codingwithanonymous890 2 ปีที่แล้ว

    Best explaination

  • @MANOJKUMARAM-q2n
    @MANOJKUMARAM-q2n หลายเดือนก่อน

    I have the other solution but the complexity is same : class Solution:
    def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
    queue = deque()
    count = 0
    output = []
    for i in range(len(nums)):
    if len(queue) == 0:
    queue.append(nums[i])
    else:
    while len(queue) != 0 and queue[-1] < nums[i]:
    queue.pop()
    queue.append(nums[i])
    count += 1
    if count == k:
    output.append(queue[0])
    if nums[(i + 1) - k] == queue[0]:
    queue.popleft()
    count -= 1
    return output

  • @anupam6045
    @anupam6045 2 ปีที่แล้ว

    very nice explanation di

  • @NagaVenkateshgavini
    @NagaVenkateshgavini ปีที่แล้ว

    proper explanation !!

  • @basudebroy325
    @basudebroy325 ปีที่แล้ว

    Very very thanks didi..

  • @bharathkumar5870
    @bharathkumar5870 3 ปีที่แล้ว +1

    thanks dude

  • @MANOJKUMARAM-q2n
    @MANOJKUMARAM-q2n หลายเดือนก่อน

    class Solution:
    def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
    queue = deque()
    count = 0
    output = []
    for i in range(len(nums)):
    if len(queue) == 0:
    queue.append(nums[i])
    else:
    while len(queue) != 0 and queue[-1] < nums[i]:
    queue.pop()
    queue.append(nums[i])
    count += 1
    if count == k:
    output.append(queue[0])
    if nums[(i + 1) - k] == queue[0]:
    queue.popleft()
    count -= 1
    return output

  • @baazigaraxcode4994
    @baazigaraxcode4994 ปีที่แล้ว

    Love uhh mam❤️

  • @sushantgupta4757
    @sushantgupta4757 2 ปีที่แล้ว

    thanku didi

  • @raushankumar6993
    @raushankumar6993 ปีที่แล้ว

    thanks

  • @bhanu0774
    @bhanu0774 ปีที่แล้ว

    Best

  • @vishaldhiman1625
    @vishaldhiman1625 2 ปีที่แล้ว

    Can we use set instead of deque?

    • @shalsteven
      @shalsteven 2 ปีที่แล้ว +1

      set can't be modified isn't it?

  • @dheerajsingh179
    @dheerajsingh179 2 ปีที่แล้ว +2

    This code is showing error

    • @chiragsharma7022
      @chiragsharma7022 ปีที่แล้ว

      Yes bro it's showing an error. Please provide correct code mam

  • @JohnWickea
    @JohnWickea ปีที่แล้ว

    [4,3,11],k=3
    showing wrong answer

  • @manishkumar-uw5mw
    @manishkumar-uw5mw ปีที่แล้ว

    Lallontop ❤

  • @DeepanshMaurya-w7i
    @DeepanshMaurya-w7i ปีที่แล้ว +1

    why i-k in line no. 21

    • @jaykeer8662
      @jaykeer8662 ปีที่แล้ว

      Same question

    • @JohnWickea
      @JohnWickea ปีที่แล้ว

      it's coz if the current max element(front) is present in the previous subarray as well ,so that means we have to delete/remove that element . gotcha?

    • @NagaVenkateshgavini
      @NagaVenkateshgavini ปีที่แล้ว

      If you do nums[i-k], it equals the front of the deque. That means we moved to the next window.
      Do it by yourself for the last window, you will understand.