Maximum Product Subarray - Best Intuitive Approach Discussed

Sdílet
Vložit
  • čas přidán 23. 07. 2024
  • Problem Link: bit.ly/3VPdyyq
    Notes/C++/Java/Python codes: takeuforward.org/data-structu...
    We have solved the problem, and we have gone from brute force and ended with the most optimal solution. Every approach's code has been written in the video itself. Also, we have covered the algorithm with intuition.
    Full Course: bit.ly/tufA2ZYt
    You can follow me across social media, all my handles are below:
    Linkedin/Instagram/Telegram: linktr.ee/takeUforward
    0:00 Introduction of Course

Komentáře • 312

  • @Iron_Man019
    @Iron_Man019 Před rokem +156

    He is a real competitive programmer in all CZcamsrs who teaches DSA in India

    • @lakshsinghania
      @lakshsinghania Před 2 měsíci +3

      guys who do cp have better problem solving skills, even doing dsa gives but cp just opens the brain to think in diff solutions

  • @SHASHANKRUSTAGII
    @SHASHANKRUSTAGII Před rokem +180

    I had never seen this approach and the way you explain is like you own it.!!!
    Superb work striver bro

  • @Brutal-gz3jz
    @Brutal-gz3jz Před měsícem +23

    In leetcode take double for suffix,prefix and return value .so the last test case not gonna be int overflow

    • @sumeetsinghaaryan
      @sumeetsinghaaryan Před 21 dnem +9

      double maxPro = Integer.MIN_VALUE;
      double pre = 1, suff = 1;
      int len = nums.length;
      for(int i=0; i

    • @shishirkarki9001
      @shishirkarki9001 Před 15 dny +1

      @@sumeetsinghaaryan why is it working for double but shows overflow error when using long?

    • @VISHALTHAKUR-gg3dg
      @VISHALTHAKUR-gg3dg Před 10 dny

      @@shishirkarki9001 i also didnt get it ?

    • @shishirkarki9001
      @shishirkarki9001 Před 9 dny +1

      @@VISHALTHAKUR-gg3dg i came to know that double has larger range than long

  • @MischievousSoul
    @MischievousSoul Před rokem +17

    I was literally searching for the intuitive approach and finally found it.. really appreciate it..
    and a great explanation..

  • @chiragbansod8252
    @chiragbansod8252 Před 4 měsíci +6

    Completed this playlist also, MAN this is the best teacher of DSA. UNDERSTOOD!!!!!!!

  • @aryanyadav3926
    @aryanyadav3926 Před rokem +11

    Brilliant! this is actually much more intuitive as I was also thinking of applying prefix and suffix in it, just couldn't react to the final answer.
    Thanks.

  • @najimali32
    @najimali32 Před 2 měsíci +3

    This approach is awesome! I've seen others teaching the same old Kadane approach, but this observation-based method is a real gem. Keep up the great work and keep sharing your insights!

  • @pramodharshav6091
    @pramodharshav6091 Před rokem +27

    You're God sent for us to learn in last moment ❤

  • @SusinSunilkumar
    @SusinSunilkumar Před 7 měsíci +2

    bro no need any more examples you were the best in explaining this question with the most examples the cases...
    Really understood the concept very well. Thank you for the video...

  • @AbjSir
    @AbjSir Před 9 měsíci +13

    Arrays completed
    Tomorrow I will revise full arrays before starting binary search

  • @cinime
    @cinime Před rokem +4

    Understood! Super awesome explanation as always, thank you very very very much for your effort!!

  • @AJK-a2j00k4
    @AJK-a2j00k4 Před 3 měsíci

    The way he did it in one go without taking separate arrays before and after 0 like I did.. hatsoff you are truly amazing!

  • @CrytpoDeFi308
    @CrytpoDeFi308 Před 11 měsíci +3

    Was struggling to understand the explanation of this problem, but after tour video I am amazed how easy it is :D

  • @calvinseptyanto3110
    @calvinseptyanto3110 Před 6 měsíci +5

    Had to give this a like, can't lie the best explanation for this problem.

  • @madhulikaghosh3876
    @madhulikaghosh3876 Před 3 měsíci +1

    Happy to see your video. So many videos I watched for this question. Finally i can get the intutive for the question.

  • @messi_codes
    @messi_codes Před 10 měsíci +4

    Best Solution , will never forget this solution .

  • @santanu29
    @santanu29 Před rokem +1

    You learn something new everyday ❤. This is the reason I love your videos. Got to learn something new.

  • @saunaknandi1814
    @saunaknandi1814 Před rokem +42

    Hey Striver can you add the famous Egg Dropping Problem in your DP series? It will be of great help to many students.

  • @vikasbagri1225
    @vikasbagri1225 Před rokem +9

    I do not know who has observed the optimal approach but whoever the guy was, it was brilliant
    Thanks for your explanation Striver
    Understood it very well
    And waiting for your Binary Search series...

  • @KishoreKumar-xr3fu
    @KishoreKumar-xr3fu Před 2 měsíci +2

    Best explanation ever i have seen for this. Thank you bro 🙏

  • @halcyonramirez6469
    @halcyonramirez6469 Před 11 měsíci +2

    I actually understand this and it makes so much sense. Thanks!

  • @torishi82
    @torishi82 Před 14 dny +1

    Best explanations and best qualities. You are a striver indeed.

  • @Irfankhan-nc2gt
    @Irfankhan-nc2gt Před rokem

    Thankyou Bro❤ I have Huge of respect and Thankfulness for you 🎉you are doing such a great thing ❤❤

  • @CinematicClips-uz3mk
    @CinematicClips-uz3mk Před 2 měsíci +2

    Completed this playlist.... Gain confidence and knowledge.... Thank you Bhaiya ❤❤

  • @trailblazer555
    @trailblazer555 Před 28 dny +1

    The way he explained made me to think how to really approach a problem with logical thinking...Great Striver!!!

  • @anshlyk
    @anshlyk Před 10 měsíci

    Thanks for the great explanation, it feels like you are explaining me one to one the way you place your face on the screen!!

  • @ashutoshupadhyay5683
    @ashutoshupadhyay5683 Před 11 měsíci

    u just fired it man.....what an awesome explanation....Thanks bro for the help.

  • @user-ru8kq9ci5t
    @user-ru8kq9ci5t Před 5 měsíci +1

    Thanks for the great playlists for DSA

  • @killeraloo3247
    @killeraloo3247 Před 10 měsíci

    Bhai mast video thi. Teeno algo's samajh mein aa gyin.

  • @zaid6493
    @zaid6493 Před rokem +1

    awesome teaching and please teach every problem how to identify the pattern which algo we need to used.. and try to explain all the approaches. by the way your videos are great you will deserve 1m soon.

  • @harshraj3522
    @harshraj3522 Před 11 měsíci

    finally array completed..thanks striver bhaiya

  • @harshgupta5287
    @harshgupta5287 Před 4 dny +1

    Just a small change in the code for those who are wondering why 191th test case is not passing on leetcode, just change the data type of ans, pre and suff to double so as to prevent overflow in the intermediate steps. It has much bigger range than long and long long. Btw great explaination striver!!

  • @stith_pragya
    @stith_pragya Před 3 měsíci +1

    Thank You So Much for this wonderful video.......................🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @Lord_Biyoma
    @Lord_Biyoma Před 7 měsíci

    superb and easy to understand explanation !

  • @Anything-cx4bs
    @Anything-cx4bs Před měsícem +2

    you are really the best teacher available on youtube

  • @stith_pragya
    @stith_pragya Před 3 měsíci +1

    UNDERSTOOD.............Thanks a ton............🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻🙏🏻

  • @ishangujarathi10
    @ishangujarathi10 Před rokem

    the optimal solution, too good and intuitive as you saidd!!!

  • @sayyidzyanashraf
    @sayyidzyanashraf Před měsícem

    Nice Explanation and intuition for this problem.. Thanks a million Striver. ♥♥♥

  • @mohammedharoon1167
    @mohammedharoon1167 Před 19 dny

    Just another level 🔥

  • @dank7044
    @dank7044 Před 8 dny

    I think the super clean implementation was very nice.

  • @LokeshSharma-hm5jz
    @LokeshSharma-hm5jz Před rokem

    very nice video, Just like a story. Thanks.
    great

  • @dhanushsanapala3287

    the best approach i have ever seen

  • @prashanthreddy3840
    @prashanthreddy3840 Před 2 měsíci

    This approach is excellent.

  • @AbhishekKumar-dl6ko
    @AbhishekKumar-dl6ko Před 2 měsíci

    Completed Arrays on 09/05/24 ..Superb Content and Explanation .....

  • @bajrangijha
    @bajrangijha Před 3 měsíci

    mind blowing approach

  • @belugaop7784
    @belugaop7784 Před 3 měsíci +3

    i generally dont comment on videos , but yaar striver truly is a genius

  • @ujjvalsharma5055
    @ujjvalsharma5055 Před 10 měsíci

    Great Approach!

  • @dayashankarlakhotia4943

    Good explanation and much intuitive

  • @tungvuthanh5537
    @tungvuthanh5537 Před 10 měsíci +3

    I have watched the solution of neetcode and i must admit that you solution is very intuitive 😂

  • @arghyamaji9131
    @arghyamaji9131 Před rokem

    excellent explanation striver!

  • @funcode-tw3cg
    @funcode-tw3cg Před rokem

    excellent approach !!

  • @dsa_tutorial
    @dsa_tutorial Před 24 dny

    really great explaination !!!

  • @thedon713
    @thedon713 Před rokem +4

    Hey Brother..At first thank you for your great work..Now I am learning Recursion from your recursion playlist..Love you from Bangladesh

  • @tanaysingh5348
    @tanaysingh5348 Před rokem +1

    Really needed this

  • @Rohit-fz4vd
    @Rohit-fz4vd Před 3 měsíci

    im so happy that i did this prblm both brute and optimal by myself....only difference in my code was i did traversal two times to calc prefix and suffix😅. BTW THANKS STRIVER YOU ARE GREAT🙇

  • @Manishgupta200
    @Manishgupta200 Před rokem +1

    The logical thinking It's very easy to understand.. with TC -> O(N) and SC -> O(1)

  • @Ramsiya658
    @Ramsiya658 Před rokem +1

    Understood striver much love to you

  • @himanshusingh6229
    @himanshusingh6229 Před měsícem

    Huge respect brother♥

  • @samratgupta731
    @samratgupta731 Před rokem

    Very well explained 👏

  • @debanjan10
    @debanjan10 Před rokem

    Areh Dada ,,, watta approach

  • @SANJAY-yg3fp
    @SANJAY-yg3fp Před rokem

    THANK YOU SO MUCH...VERY HELPFUL BRO.......

  • @gauravharbola1334
    @gauravharbola1334 Před 11 měsíci +1

    Hi striver, first of all this is the best video that i have seen till now for this problem. Secondly, don't you think this is kadanes algorithm only. We did the same thing like adding all the elements till the end and when we got a negative element will turned that to 0. But this time we are doing from both the sides....

  • @cruzer_blade.
    @cruzer_blade. Před 5 měsíci +1

    best explanation sir 😁😁

  • @jasonhuang12
    @jasonhuang12 Před 11 měsíci

    Hello, thank you for the awesome explanation. Wondering what tool are you using for electronic drawing?

  • @akshdhingra2700
    @akshdhingra2700 Před měsícem

    This Guy is Next Level

  • @NazeerBashaShaik
    @NazeerBashaShaik Před 3 měsíci

    Understood, thank you.

  • @rithikgandhi3685
    @rithikgandhi3685 Před 3 měsíci

    Great solution

  • @shreyas0924
    @shreyas0924 Před 4 měsíci

    This was a good one!!

  • @pubgbattleground9208
    @pubgbattleground9208 Před rokem

    ek number solution!!

  • @anupamsinghmnnitallahabad6226

    what an approach sir

  • @selvaarumugam370
    @selvaarumugam370 Před rokem +2

    U jus explained the problem in a way it was made simple

    • @hi-tk4hu
      @hi-tk4hu Před rokem

      Yes when I first saw the solution with kadanes it made me depressed fr, but this approach I will never forget

  • @hashcodez757
    @hashcodez757 Před měsícem

    Understood Bhaiya!!

  • @shaurya2608
    @shaurya2608 Před rokem

    Great approach

  • @niharikakumar1533
    @niharikakumar1533 Před 6 měsíci

    Thank you bhaiya 🙂

  • @Josuke217
    @Josuke217 Před 6 dny

    Nice solution

  • @user-nk1mb5fy7j
    @user-nk1mb5fy7j Před rokem

    UNDERSTOOD 🔥🔥🔥🔥

  • @divyagupta6854
    @divyagupta6854 Před rokem

    That is an awesome presentation tool. Can you tell me which tool you used for this?

  • @YourCodeVerse
    @YourCodeVerse Před 7 měsíci

    Understood✅🔥🔥

  • @shanthi5541
    @shanthi5541 Před rokem

    bro you are genius!!!!

  • @rosepainting8775
    @rosepainting8775 Před rokem +2

    I have solved this problem before, but still I would like to know your approach on this

  • @maruthiteja2586
    @maruthiteja2586 Před rokem

    Amazing ❤

  • @karteek9695
    @karteek9695 Před rokem

    Damn !!! That was good .

  • @chiragdhunna990
    @chiragdhunna990 Před rokem

    Thanks Bhaiya!!

  • @parth2439
    @parth2439 Před rokem

    Thank you!!

  • @sukhpreetsingh5200
    @sukhpreetsingh5200 Před rokem +3

    amazing explanation just amaze with the approach

    • @PDSREACTION
      @PDSREACTION Před rokem

      bro is this array playlist good?

    • @sukhpreetsingh5200
      @sukhpreetsingh5200 Před rokem +3

      @@PDSREACTION Not only array but all the playlists brothers without any doubt

  • @nageshwarmali9631
    @nageshwarmali9631 Před 10 měsíci

    wow just amazing

  • @aryangautam7506
    @aryangautam7506 Před rokem

    What an explanation

  • @mr_weird3680
    @mr_weird3680 Před 2 měsíci

    Thanks Brother💌

  • @AdityaSingh-ql9ke
    @AdityaSingh-ql9ke Před rokem +3

    After your hinting, I got the approach...but then I realized ,if we have 0s, then what to do

  • @oguluribrahmaiah1301
    @oguluribrahmaiah1301 Před 7 měsíci

    Understood😊

  • @rajeswarichalamcherla2860

    Understood!!!!!❤

  • @rajatpatra2593
    @rajatpatra2593 Před rokem

    Understood ❤️

  • @bikramsingh3472
    @bikramsingh3472 Před 10 měsíci

    nice one sir

  • @priyadarsinipaikaray4998

    Helpful ❤

  • @DEVLOKS
    @DEVLOKS Před 2 měsíci

    Thank you bhaiya

  • @user-vp9qo3sv6f
    @user-vp9qo3sv6f Před 4 měsíci

    simply GOAT

  • @jasmin_bheda
    @jasmin_bheda Před rokem

    bro how can i thank you enough ? ❤❤❤

  • @user-kk9cr4jt4r
    @user-kk9cr4jt4r Před 8 měsíci

    U r a legend ❤❤

  • @RituSingh-ne1mk
    @RituSingh-ne1mk Před 7 měsíci

    Understood!

  • @amityadav-np1rk
    @amityadav-np1rk Před rokem

    thank you!!