Max Consecutive Ones III | Leetcode June Challenge | Leetcode 1004 | Approach + Code | C++ | Python

Поделиться
HTML-код
  • Опубликовано: 2 фев 2025

Комментарии •

  • @robinofautumn99
    @robinofautumn99 10 месяцев назад +1

    was half way through your video, but completely understood the concept... thanks Di😄😄😄😄

  • @phantom3612
    @phantom3612 Год назад

    Understood! thanks.
    C++ implementation ---
    //ALGORITHM: Basically we see arr, we see k. Voila!\
    //Sliding window problem. Now to tackle this.
    //We take i=j=0. ans=0 and zerocount=0
    //Basically, j will keep on moving till
    //we our zerocount > k. At that point.
    //we first do ans = max(ans, j-i+1)
    //next obv, we need to move i (that is,
    //sliding the fucking window.)
    //Now till when? Glad you asked!
    //We do it until we get a pass! (i.e. our
    //zerocount becomes equal to k
    //at that point we simply go back to moving j
    //untill we see another 0 focring us to incrment
    //zerocount. Thus the steps repeat)
    int longestSubSeg(vector &arr , int n, int k){
    int i=0, j=0, ans=0, zerocount=0;
    while(j

  • @AkashYadav-po5kb
    @AkashYadav-po5kb Год назад +1

    Phli ladki dekho hai jiski coding itni acchi h , very good explanation, keep it up and subscribed👍

  • @devanshdixitmusicallyyours3885
    @devanshdixitmusicallyyours3885 2 года назад +3

    pls make more such videos , u have literally explained this problem so amazingly... thank u

  • @RahulVerma-fz2jf
    @RahulVerma-fz2jf 2 года назад +1

    Great job. Explanation is really clear. After this, I hope I don't mess the implementation again in the interview.

  • @mayank_singh_43
    @mayank_singh_43 Год назад

    Awsm explaination, best on utube

  • @suruchikumari8371
    @suruchikumari8371 Год назад

    Today i visit your channel first time while facing difficulties solving this problem.... really you explained very well dii...now my all doubts are cleared about two pointer approach.....

  • @sanskarsinghh
    @sanskarsinghh Год назад

    Thank you for the crystal clear explanation didi :)

  • @ninadkheratkar6716
    @ninadkheratkar6716 Год назад

    Thank you for the detailed explanation!

  • @RohitGupta-xf3zp
    @RohitGupta-xf3zp Год назад

    Thanks dii very easy and clear explanation.

  • @nandiniverma5273
    @nandiniverma5273 Год назад

    Very Good Dry run , thanks

  • @shripadkhandare
    @shripadkhandare 10 месяцев назад

    Thanks For Nice explanation.

  • @tusharjeena7081
    @tusharjeena7081 Год назад

    mam your voice is so sweet

  • @ankitnishad7831
    @ankitnishad7831 2 года назад

    I tried this question by myself but couldn't make through some cases nice explanation got to know what I was mistaking.

  • @nomore_alive9262
    @nomore_alive9262 10 месяцев назад

    Koi chakkar ni🤘🤘

  • @krishnavamsichinnapareddy
    @krishnavamsichinnapareddy Год назад

    Very good explanation 👍

  • @VijayPatel-ez4lp
    @VijayPatel-ez4lp 2 года назад +1

    thanku mam
    nice explanation

  • @Akash-Bisariya
    @Akash-Bisariya Год назад

    Thanks for explaining so nicely!!

  • @vivekswami2182
    @vivekswami2182 2 года назад

    Really amazing explanation, loved it !!

  • @vishalsrivastavavishalsri92
    @vishalsrivastavavishalsri92 Год назад

    For input "111000" and k=1 the answer should be 3 but your code will give 4 since there is no information about the number of 1s.

    • @Ramneet04
      @Ramneet04 Год назад

      I think it should be 4 only . Why do you think its going to be 3???

  • @rushikeshubale3478
    @rushikeshubale3478 Год назад

    Nice explanation. Thanks!

  • @harshexploring4922
    @harshexploring4922 2 года назад

    The explaination was really great

  • @anupkhismatrao9280
    @anupkhismatrao9280 Год назад

    Amazing explanation ❤

  • @abhaythakur2597
    @abhaythakur2597 Год назад

    very well explained

  • @tot7997
    @tot7997 Год назад

    thanks a lot.. amazing explanation ❤

  • @davinder95
    @davinder95 2 года назад

    dusre while ki jagah if b chl jata no need to used two whiles

  • @chandlerbing8164
    @chandlerbing8164 10 месяцев назад

    to draw do you use mouse only or graphics tablet or you have touch screen ?

  • @beastcracker117
    @beastcracker117 Год назад

    Shukria ❤

  • @GhostRider....
    @GhostRider.... 2 года назад

    nice explanation

  • @MoreofSHRUTI
    @MoreofSHRUTI 10 месяцев назад

    useful

  • @goluhimanshu9985
    @goluhimanshu9985 2 месяца назад

    Koi chakkar nhi h😊😂

  • @adj5951
    @adj5951 11 месяцев назад

    I think you should explain more clearly, it was a bit complex to understand, i understood the concept, but then how to play with i and j was a bit difficult to comprehend

  • @ashutoshbajpai3133
    @ashutoshbajpai3133 2 года назад

    great explaination

  • @rahulsati5819
    @rahulsati5819 2 года назад

    thnks amazing explanation

  • @amanranjan2684
    @amanranjan2684 Год назад

    thx

  • @aishwaryarathod5421
    @aishwaryarathod5421 3 года назад

    oyy dii,, its not sliding window
    its two pointer method

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 года назад +5

      Oyy geeks, we are maintaing a window having at most k zeros everytime. It's sliding window🙂

    • @exploringworld6817
      @exploringworld6817 3 года назад

      @@AyushiSharmaDSA epic reply😂

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 года назад

      @@exploringworld6817 😂😂😅

    • @aishwaryarathod5421
      @aishwaryarathod5421 3 года назад

      🥸🥸,, your ans is like
      I'm justifying my ans with the reason you use 2 pointers🙂.

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 года назад +1

      @@aishwaryarathod5421 Bro, there are different approaches. You can try whichever you like. 😃

  • @exploringworld6817
    @exploringworld6817 3 года назад

    Time complexity kya rahegi?

  • @divyansh1391
    @divyansh1391 2 года назад

    thanks di❤

  • @sahilverma4142
    @sahilverma4142 3 года назад +1

    Phir Level add ni kiye😔

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 года назад +1

      I added in thumbnail. Do you want me to add in title?

    • @exploringworld6817
      @exploringworld6817 3 года назад

      @@AyushiSharmaDSA okk chlega

    • @AyushiSharmaDSA
      @AyushiSharmaDSA  3 года назад +1

      @@exploringworld6817 I'll add in title from next time👍🏻

  • @AdityaSingh-li4km
    @AdityaSingh-li4km Год назад

    Hello ,
    can u ecplain why this works ?
    zeros, l = 0, 0
    for r, n in enumerate(nums):
    zeros += n == 0
    if zeros > k:
    zeros -= nums[l] == 0
    l += 1
    print(r,l,len(nums))
    return r - l + 1

  • @Montu-j2r
    @Montu-j2r Год назад

    nice explanation