Max Consecutive Ones | Leetcode

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

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

  • @takeUforward
    @takeUforward  4 года назад +5

    Do leave a comment if you get the solution :) helps me a lot
    C++ Code link: github.com/striver79/SDESheet/blob/main/consecutiveOnesCpp
    Java Code link: github.com/striver79/SDESheet/blob/main/consecutiveOnesJava
    Instagram: striver_79
    Join our telegram group: t.me/Competitive_Programming_tuf

  • @willturner3440
    @willturner3440 3 года назад +75

    I solved 400+ problems on leetcode but still watching this easy one problem because of you striver.. ✌

  • @NiranjanKumar-yj3mn
    @NiranjanKumar-yj3mn 2 года назад +12

    i thought of same logic, but was scared to code it. watched ur video till 2min 53s and got confidence to try coding it myself and i can tell i feel good. Still beginner in dsa! Thank you TUF!

  • @ishanshah3309
    @ishanshah3309 4 года назад +23

    I had solved this question already in leetcode but still saw your video because I just like to watch your videos even if I know the video content already.

  • @roushanraj8530
    @roushanraj8530 4 года назад +15

    Your explanation is way smoother that any one can imagine 💥💥🙏💯💥

  • @mikedelta658
    @mikedelta658 Год назад +1

    A wonderful and simple explanation. Thanks man!

  • @ayushthakur733
    @ayushthakur733 4 года назад +8

    This series is too good 🙌🙂

  • @roushanraj8530
    @roushanraj8530 4 года назад +4

    Thank you bhya, for making videos for us, we all love you 💓💓💯💯💯

  • @jatingarg1897
    @jatingarg1897 2 года назад +2

    Bhai. You are a Farishta for a Tier 3 Student. I started loving DSA just because of you.

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

    Nice explanation your videos are really good...please keep on making such videos.

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

    Thank You So Much Striver Brother.............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @coefficient1359
    @coefficient1359 4 года назад +3

    This is an easy one ✌

  • @ranasauravsingh
    @ranasauravsingh 2 года назад +1

    UNDERSTOOD...!!!
    Thanks striver for the video... :)

  • @budhadityachatterjee6270
    @budhadityachatterjee6270 4 года назад +2

    Keep up the amazing work man 👍👍 .

  • @parikshitrathore1510
    @parikshitrathore1510 4 года назад +4

    Understood😎😎

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

    great bhiya , love your series of DSA

  • @sagarkrishnabose8612
    @sagarkrishnabose8612 4 года назад +1

    Amazing! Loved the explaination

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

    Thank you Striver Bhaiya!!

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

    ok so, shouldn t you put another maxi = max (maxi, cnt); before cnt = 0;? or otherwise you will lose the count at the first number that s not 1?

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

      No because maxi is updated at every step so definitely it would have been saved in last step.

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

      @@aanchalmittal9897 how maxi is updated i am not getting it...i am newby

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

    Great tutorial, helped a lot! Thank You!

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

    You ae the bestest ♥️♥️♥️♥️

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

    it is a dynamic programming question.

  • @Abhishek-yy3xg
    @Abhishek-yy3xg 3 года назад

    Thank you 🤗

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

    Nice explain plz upload more vedio

  • @palakmittal5477
    @palakmittal5477 4 года назад +3

    I have performed the exactly same code on leetcode without even watching solution. Runtime: 84 ms, faster than 36.73% of C++ online submissions for Max Consecutive Ones. But why 36.73 ? I don't think this could be optimized to O(1) or O(log n)

    • @takeUforward
      @takeUforward  4 года назад +6

      Ignore that, it cannot be better than that. So chill out. Don’t focus on that focus on the tc and sc

    • @palakmittal5477
      @palakmittal5477 4 года назад

      @@takeUforward ok bhaiya! thanks for clearing doubt :)

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

      for the same code when i run multiple times it gave different runtime..dont even bother about it...it depends on processor speed, internet speed, server speed. Time Complexity and Space Complexity are important

  • @HarshGupta-g7r
    @HarshGupta-g7r Год назад

    I copied line by line the code you wrote .! Still its showing runtime error .. Can you please explain why this is happening

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

    The gfg link in DSA sheet is not the exact problem. Please have a look sir and please upload a solution for that problem

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

    thanks

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

    Thankyou

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

    to the expectation!!

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

    I did it by two pointer, same thing however

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

    7️⃣✅

  • @NARUTOUZUMAKI-bk4nx
    @NARUTOUZUMAKI-bk4nx Год назад

    Understood

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

    #Understood

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

    This problem is pretty easy as compared to other problems of this day and even before this day, and it doesn't even use 2 pointer approach, so why categorize this in this category.

  • @binodbinod7537
    @binodbinod7537 4 года назад +1

    Kaise ho bhaiya?

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

    nice :)

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

    I am able to figure out the logic of such questions but unable to write the code structure being a beginnner. anyone else facing this problem

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

      yes me too? have u figured out this problem?

  • @finster156
    @finster156 4 года назад +1

    2nd view❤️❤️

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

    How it is two pointer

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

    The problem is very similar to max subarray... actually as I started watching I remembered there's a question similar to kadane's algo

  • @devprakash5320
    @devprakash5320 4 года назад

    I thought he'd use bit manipulation

  • @JohnDoe-ej6vm
    @JohnDoe-ej6vm 2 года назад

    i spent 90 minutes but could not solve this problem. i am really worried.

    • @JohnDoe-ej6vm
      @JohnDoe-ej6vm 2 года назад

      after watching 3 minutes of the video i tried again and it took 10 minutes to solve this problem. my code is different. kia is terha ap ka concept copy krny sy mery skills develop hongy ?

    • @JohnDoe-ej6vm
      @JohnDoe-ej6vm 2 года назад

      only difference in code is i used ternary operator instead of Math.max . which one is fast and consume less space ?

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

      @@JohnDoe-ej6vm haan bhai hongi skills develop, starting me time lagta h, 15 - 20 min bahut hote h thinking ke liye uske baad dekh lia kro solutions

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

      @@JohnDoe-ej6vm har topic ke starting ke 15-20 questions ke soltuion dekh kar skte ho