Kadane's Algo in 16 minutes || Algorithms for Placements

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

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

  • @RajeshSharmaIndia
    @RajeshSharmaIndia ปีที่แล้ว +6

    i just came to your video , i am afraid about DSA , Now i just see that video and now i am confident that i can also solve the problems, your way of teaching is quite simple and easy. thanks a lot.

  • @Caroline-up8qw
    @Caroline-up8qw ปีที่แล้ว +6

    Nooooo one can explain better than him...Thank you Sir for such an easy explanation

  • @odiacomdeyu.s3148
    @odiacomdeyu.s3148 2 ปีที่แล้ว +28

    When you study great teachers… you will learn much more from their caring and hard work than from their style. TQ sir

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

    This was an amazing example sir, if we wanted we would have made this code a lot more heavier and complex. Increasing its complexity.
    But your video showed us an follow process to make the code optimal and reduce the complexity to lowest possible.

  • @maheshbk-dh1co
    @maheshbk-dh1co ปีที่แล้ว +3

    You are going to revolutnize the coding universe....💯💯
    love from nepal..🥰

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

    Even if we are asked for size of longest subarray which yields the max sum , we can use Concept of Variable size window to find the sum(mx sum using kadane ) . Time => O(n)

    • @Asad-pq7el
      @Asad-pq7el 2 ปีที่แล้ว

      bhai 2 loop use karke all subarray kaise nikal sakte hai?

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

      @@Asad-pq7el take a vector sum and intial array of size n, then
      go i = 0->n, where there's a var x = 0 & max = 0
      then run j = i -> n, where x += arr[j] and if arr[j] beginner than max update it and also store the i & j index in another var a,b..
      after the whole iteration is completed, you'll have a, b which is the starting & finishing index of the longest subarray with max sum..

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

    so nice to see someone who can explain things just as easy as this, I understood everything concept he explained while I can speak nor hear a single word in indian language, imagine if he were speaking in English 🤣🤣, a great teacher always finds a way to make students understands what he means. Thanks India for producing such indian talents.

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

    explained from basics, so best explanation ever thank uuuu😇

  • @KaushikSharma-c3q
    @KaushikSharma-c3q ปีที่แล้ว +1

    One of the most important approach for the complex problem of array.

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

    Thank you bhaiya ....just isko sikhne ke bad maine lagatar 2 questions solve kar di with some modifications for different problems

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

    170 Bhaiya aapke ecplainations ki etni aadat hui hai ki ab baki khi se bhi padho kuch samj nahi aata
    Besttesstttt explaination & Bhaiyaaaa Everrrr😍

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

    The playlist that I've been searching all over the internet and finally you started it.., thankyou for making it❣️

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

    Nice Man just opened my concepts crystal clear

  • @AbhishekGupta-vu7xd
    @AbhishekGupta-vu7xd ปีที่แล้ว

    Ek baar mein hi samjh aa gaya thanks mahan guru ji 😊

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

    Some Nigaa Said "This was an amazing example sir, if we wanted we would have made this code a lot more heavier and complex. Increasing its complexity. But your video showed us an follow process to make the code optimal and reduce the complexity to lowest possible."

  • @abhishekkumar-xm3nj
    @abhishekkumar-xm3nj หลายเดือนก่อน

    jab koi video khojta hu kisi topic se related aur agar aapka dikh jata hai to suprise milta hai ek bara wala. aur mera man Doubt ko kehta hai "Ab to tu gaya beta"

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

    Simply great explanation, great bhaiya 🔥🔥🙌🙌

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

    most valuble content bhaiya majaa aa gya
    😀😀

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

    Wonderful explanation.... did't know that. it is that much easy.

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

    Another game changing playlist started...kudos to you sir...DAY 1 ✅

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

    Efforts >>>3 man ❤️

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

    Bhaiyya ,love the video and solution,
    Please upload the lecture on-
    "sliding windows algorithm"

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

    Best Explanation bhaiya

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

    Bhaiya swad aa jaata haii apki video dekh k❤💯

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

    Thank you so much sir nice explanation and easy to understand ❤️

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

    thankyou bhaiya for easy and to the point concept of kadane's algo.

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

    bhoat time se wait kr Raha tha ..

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

    I have gone through multiple videos none of them helped me to understand Kandane's algorithm. This video does

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

    top notch explanation !

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

    truly the best explaination

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

    Thank You Bhaiya for Completing the Remaining Algorithms

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

    Ye bari achi initiative liya hai aapne bhaiya 👍👍

  • @AKSHAYKUMAR-ht1tl
    @AKSHAYKUMAR-ht1tl 6 หลายเดือนก่อน

    majaa aa gyaa bro. keep it up!!

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

    Pls add this video in DSA series playlist, I didn't knew about this algo for maximum contiguous product.

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

    Thank you so much bhaiya😁❤️
    So much love to you

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

    good explanation bhaiya

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

    Bhaiya,
    A suggestion for Dsa series--
    Could you please create a schedule kinda like when to start when to end what ,
    An excel sheet or something where we can enter our start date nd the rest dates will b decided logically for whole dsa plan ,this will give us a fair idea of which vdo/homework/tasks should take what time for completion.
    We can stick to that and try to complete the course within the deadlines as mentioned in the sheet.
    Problem in self is that we don't get an idea how much to do each day or how to allocate number of days to each topic,thus we exaggerate the things without proper plan leading to non completion of tasks

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

    thanks bhaiya you made dsa easy for me

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

    Amazing Explanation Sir

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

    You found the sum but which sub array produced that highest sum was not shown in code. How do we highlight which sub array has the highest sum?

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

    understood the concept thank you babbar bhai

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

    Kudos to your hardwork 👏

  • @ManishYadav-dt2qc
    @ManishYadav-dt2qc 2 ปีที่แล้ว

    Achha lga app ka btane ka trika ♥️

  • @revolverlim.6444
    @revolverlim.6444 9 หลายเดือนก่อน +1

    mst samjaya bhaiya

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

    Thankuu bro... For your efforts..❤🙏

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

    Hello Jiii ...web development course kabhi upload honge bhaiya ?Excited to learn web development from ur end...

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

    great explanation! thank you for this

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

    Nice explanation sir ......

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

    Thankyou bhaiya, I understood it clearly now...😄 I wanted to ask that will us be ever able to actually make these kind of algorithms ourseleves? Like learning sliding windows, kadane's algo and other algos is different thing and making them is different.

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

      To actually make algorithms you can do your research/phd in algorithms. These algorithms were made in budding days of computer science and algos are mainly build by mathematicians. Like this kadane algo was made in 1980s

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

      @@rohanverma3111 Thanks for the info brother👍

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

      @@rohanverma3111 I want to ask that do developers make algorithms or they just see it from somewhere, or learn it and only implement it?

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

      @@sirkartik I hardly believe that any developer is building some amazing algorithms in their day to day job. No dev will write a new algo. Even if you make a decent algorithm in a project codebase on your own but it won't be approved by your seniors if some standard algo is out there. If you are interested about making algorithms you can opt for MS/PHD in CSE and can take your thesis as Algorithms. To discover new things you need to pursue research.

  • @Abhinav-db1qu
    @Abhinav-db1qu 2 หลายเดือนก่อน

    superb , thanks a lot .

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

    9:37 agar sum = -1 aya,then max(-1,-2) = -1; to hum kiu sum ko ignore kare jaab sum 0 se kam aye??

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

    thank you sir 👌👌👌👌

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

    Bhaiya plz make videos on rabin karp algo and kmp algo

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

    sir mazza aa gya 😊

  • @TON-108
    @TON-108 2 ปีที่แล้ว

    You made it easy thank you 😌

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

    if all the element in the array is -ve then apply this
    long long maxSubarraySum(int arr[], int n){

    long long max = arr[0];
    long long sum=0;
    for(int i=0;imax)
    max = sum;
    if(sum

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

    Thanks for new vedio Babbar

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

    nice explanation

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

    Amazing explanantion.

  • @ABHI-ez9hp
    @ABHI-ez9hp ปีที่แล้ว

    Kudos to your effort :)

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

    Best Explanation

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

    Thank you sir

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

    Thanks I was stuck at this program from last 3 days,sab ho gya tha sum

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

    amazing explanation!!!!!!!!!

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

    Great Explanation

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

    Any upcoming live web development batches? Your TH-cam content has been super helpful, but I want to try a live class for a more interactive learning experience. Let me know if you have any plans or updates. Thanks!

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

    Guruji dhanyavaad

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

    KMP Algorithm next pls??🙃

    • @AbhishekGupta-vu7xd
      @AbhishekGupta-vu7xd ปีที่แล้ว +1

      Han bhaiya kmp algorithm please upload the video

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

    very easily described

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

    Best explanation
    Segtree wen?

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

    Algo samjha diya apne code khud karunga😂

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

    third step needs more explanation why we need to make sum 0 if sum becomes -ve anuj bhaiya have explained it well if some one does not understand please checkout his video once.

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

    Wa Bhai ❤

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

    Thank you so much sir

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

    // COMPLETE CODE
    class Solution {
    public:
    int maxSubArray(vector& nums) {
    int sum = 0;
    int maxi = nums[0];
    for(int i=0; i

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

    Doesn't work on all negative numbers. I have to search correct Kadane's also.

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

    anyone explain the second approach in o(n^2) time complexity

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

    Bhaiya if possible can you start series on solving your 450 Dsa cracker sheet
    If you provide a bit overview of the problem also then it will be very much helpful as your explanation is excellent
    Thank you bhaiya 🙏

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

    Bhaiya please two pointer approach and sliding window algo ko bhi cover kr do

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

    Sir ,
    What if all the elements were negative....so in that case, how could we implement the condition for less than 0

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

      did you get the answer ?

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

      @@Griffith_1802 some has mentioned this code:
      function maxSubArray(nums) {
      let maxSoFar = nums[0];
      let maxEndingHere = nums[0];

      for (let i = 1; i < nums.length; i++) {
      maxEndingHere = Math.max(nums[i], maxEndingHere + nums[i]);
      maxSoFar = Math.max(maxSoFar, maxEndingHere);
      }

      return maxSoFar;
      }

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

      I guess you need to check if all elements are negative then return smallest negative else run kadane's algo.

    • @vivek-the-coder
      @vivek-the-coder 3 หลายเดือนก่อน

      we can check first that all the number are negative , then return the largest number...

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

    Thankyou for this video bhiaya

  • @ArunKumar-yg9st
    @ArunKumar-yg9st 2 ปีที่แล้ว

    Bhaiya if all elements are negative then how we will treat this question
    Bhut achha pdhate hai bhaiya aap

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

      It is handled in the case where maxi =arr[0]
      Because Atlast we are simply returning maxi.

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

    Bhaiya, can you share 2nd approach with time Complexity O(N2) .I just want to cross Verify my code ...

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

    If the array contains all negative integers than what will be the sum? since here u are excluding all the negative sum,,

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

    Patra Korsani is a God 👑
    Because he understood this algorithm even though he doesn't know ABCD

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

    New series algorithms hurray 🙂

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

    Hi ..If we want to print the specific sub array with largest sum then what needs to be done

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

    if we consider all +ve integer in array then max sum should be 12

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

    The also doesn't work for negative numbers, You need different algorithm. Following is the working implementation in Javascript:
    function maxSubArray(nums) {
    let maxSoFar = nums[0];
    let maxEndingHere = nums[0];
    for (let i = 1; i < nums.length; i++) {
    maxEndingHere = Math.max(nums[i], maxEndingHere + nums[i]);
    maxSoFar = Math.max(maxSoFar, maxEndingHere);
    }
    return maxSoFar;
    }

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

    Thank you bhaiya

  • @Anjali-bw9hd
    @Anjali-bw9hd 11 หลายเดือนก่อน +1

    doesnt work if all numbers in array are -ve, maxi will return a negative integer rather than returning 0.

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

    Can anyone tell me ans for maximum subarray sum for
    [2,0,7,8] using the above algorithm
    please

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

    What if we dont need maximum sum but instead want those subpairs which make maximum sum???

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

    Sir,According to me you cannot get all the subarrays from only 2 loops which you have used ! if so please anyone clear my doubt!

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

    Best teacher

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

    Waiting for long time, ab to placement pkki

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

    Prefix sum algorithm ki bhi video bnaeye

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

    thankyou sir

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

    Nice lecture

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

    Please make a video on Tower 🗼 of Hanoi on recursion