Maximum of all subarrays of size 'k' using Sliding Window Technique | GeeksforGeeks

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

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

  • @KaranDoshicool
    @KaranDoshicool 4 ปีที่แล้ว +66

    Just watch from 5:00 to 6:30.Thats enough to understand the best solution

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

      Thanks for the heads up.

    • @jaatharsh
      @jaatharsh 4 ปีที่แล้ว +3

      Thanks, dude, just watched in 2x from 5:00 to 7:06

    • @Nakar2
      @Nakar2 4 ปีที่แล้ว +3

      Sure, but I liked starting a little early from 4:08.

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

    best explanation ever , from any youtube video

  • @vipulkrishna19
    @vipulkrishna19 4 ปีที่แล้ว +9

    Instead of the stating the "rules" try to explain the concept that why these "rules" are used. Just make me understand the concept, Rules are coders to make.

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

    Immediatly last package on windows size after process everything, you MUST put first value in Deque to Result.

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

    Good explanation for the deque method

  • @dheerajpoonia2175
    @dheerajpoonia2175 4 ปีที่แล้ว +5

    Why you not include the time complexity of Qi.pop_back();
    In worst case if we traverse dq backward k times than this traversal is also included in O(n), please clear the doubt

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

    thanks for the explanation

  • @VikasGupta-pp9yt
    @VikasGupta-pp9yt 2 ปีที่แล้ว

    thank you so much for the solution

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

    thanks for your explanation, I could not come up with the solution using deque!

  • @vinay8163
    @vinay8163 4 ปีที่แล้ว +14

    This question is solved and made by satan itself :P

  • @ss-xh3hf
    @ss-xh3hf 4 ปีที่แล้ว +8

    she is so confused

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

    Good explanation in simple words. Keep up the good work
    Your explanation helped me solve a question of competitive programming even though I just watched the logic and not the code. Thank you so much :)

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

    Keep vale’s of array as a b c d instead of numbers

  • @akashno3542
    @akashno3542 3 ปีที่แล้ว

    for python devs ,
    def sub_max(array, k):
    result = []
    for i in range(0,len(array)-k+1):
    temp_max = max(array[i+inst] for inst in range(0,k))
    result.append(temp_max)
    return result

  • @paroo1994
    @paroo1994 4 ปีที่แล้ว +17

    This explanation of deque , is seriously one of the most useless i have ever seen

  • @amanprajapati3417
    @amanprajapati3417 3 ปีที่แล้ว

    gr8 explaination mate❤❤❤

  • @sarikaranjitkumar174
    @sarikaranjitkumar174 4 ปีที่แล้ว

    Thanks for elaborating the logic behind the problem.It was helpful.

  • @ankitrawat-acodebreaker
    @ankitrawat-acodebreaker 4 ปีที่แล้ว +7

    Bhut hagga

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

    but in each iteration why we have to use while loop for deleting elements that are not in the present window. No more than one element can be removed

    • @abhiraj.sharma
      @abhiraj.sharma 4 ปีที่แล้ว

      When the new element comes in the second window, we'd like to compare that to the elements present to the left of it.
      Hence, we run a while loop that checks whether the element to the left is greater than that of the new element coming in the window; if true, pop that left element and will add the one coming. And will continue to do so till it reaches the first position i.e. the only element present in dq.
      I understand that the problem is not itself really tough but the concept of choosing an array index rather than element for printing them in a specific order(given in question) makes it a bit tricky.

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

      @@abhiraj.sharma yeah bro.. thats ok I am saying its sufficient to write an if condition instead of while to pop out the only front element after each iteration if its not present in the window anymore.. btw I got it accepted thnx for reply

  • @sehejwahla5437
    @sehejwahla5437 3 ปีที่แล้ว

    Nice explanation. Didn't understand the reason of dislikes tho...
    Keep up nonetheless :)

  • @adityapandey2514
    @adityapandey2514 3 ปีที่แล้ว

    nice explanation, keep it up

  • @ketanchauhan1242
    @ketanchauhan1242 4 ปีที่แล้ว

    good explanation... maam...

  • @ayushagrawal6473
    @ayushagrawal6473 3 ปีที่แล้ว

    Will u please provide the explanation for method 4.
    can it be done using priority_queue.

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

    Whenever we move to new window😅

  • @ejazchowdhury7236
    @ejazchowdhury7236 4 ปีที่แล้ว

    This was very helpful, thanks

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

    so many mistakes she did while explaining deque method

  • @AyushGupta-kb9iv
    @AyushGupta-kb9iv 4 ปีที่แล้ว

    Really Very Nice and Helpful Video.

  • @nandanm3826
    @nandanm3826 4 ปีที่แล้ว

    Nice.

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

    bad explain

  • @shubham8835
    @shubham8835 3 ปีที่แล้ว

    Why do everyone has to code in c++ only .... gfg u need to work on it .. In industry level there is more use of java as compared to c++

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

    poor vocab

  • @anitadalla
    @anitadalla 4 ปีที่แล้ว +8

    Errrrrrrrrrrr.......so irritating ur voice is .....y r u taking so many breaks in between

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

    bad explanation, feels like cramming up the code

  • @vibhavairan2177
    @vibhavairan2177 4 ปีที่แล้ว

    The deque approach is not of the order n at all.

    • @ritikagupta8847
      @ritikagupta8847 4 ปีที่แล้ว

      Its O(2n) because every element is explored (added to queue or removed from queue) at most twice