Find The Maximum Subarray Sum ( LeetCode #53 ) | FREE DSA Course in JAVA | Lecture 75

Sdílet
Vložit
  • čas přidán 26. 07. 2024
  • Let's see a popular Leetcode question number 53. In this program we have to find the maximum subarray sum.
    What does this mean?
    Given an integer array nums, find the maximum contiguous subarray (containing at least one number) which has the largest sum and return the sum.
    For eg. [1, -2, 3, 4] is the array then the answer will be [3,4] and the output will be 7.
    Now as we always do in all our lectures. Let's understand a naive approach.
    We already know how to find the subarrays of a given array.
    Hence we can find the sum of all subarrays and can return the maximum sum.
    This approach will surely work but it's not efficient.
    Let's see in this lecture how we can find a more efficient approach to solving this program.
    For more information, fill out this form: forms.gle/8eiUmM92Fx563Aen9
    or call us at 8884881203
    Facebook: / thetapacademy
    Instagram: / tapacademy_online
    Linkedin: / 73820805
    Website: www.thetapacademy.com​
    #java #array #programming #programmer #coding #dsa #placement #job #itjobs

Komentáře • 76

  • @Tchknow879
    @Tchknow879 Před měsícem +1

    thanku sir for simple explanation

  • @rupeshpatil6957
    @rupeshpatil6957 Před 2 měsíci +1

    Thanks a lot Sir

  • @kiranmaik7128
    @kiranmaik7128 Před 4 dny

    Thank you so much for the Topic understood the Concept in a ease

  • @KRajesh-ej7dy
    @KRajesh-ej7dy Před rokem +27

    Rohit sir after listening to your logic no need to see the code we can write it ourselves.Thanks soo much for beautiful explination.

    • @TAPACADEMY
      @TAPACADEMY  Před rokem +4

      That's great. We are trying to deliver you the best content. Do subscribe and share the channel.

  • @GautamiPinkyar
    @GautamiPinkyar Před 21 dnem

    Thankyou so much. The explanation was superb

  • @powerofwisdomstories
    @powerofwisdomstories Před 5 měsíci

    Thank you bhaiya😃😃

  • @pradeepkumar-em5re
    @pradeepkumar-em5re Před rokem +15

    Your video on DSA in Java was truly exceptional! Your clear and concise explanations, coupled with visually appealing graphics, made learning complex algorithms a breeze. You are a master of your craft, and it was a pleasure to watch.

    • @TAPACADEMY
      @TAPACADEMY  Před rokem +2

      Glad you liked it! Please share it to your community.

  • @informer3268
    @informer3268 Před 23 dny

    i dont know some miracle happend i understood this problem very easily

  • @anushkatupe9502
    @anushkatupe9502 Před 20 dny

    GOAT❤❤❤

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

    what a teaching style ... love form bangladesh

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

    Hahaha the best video I found for this max subarray peoblem.

  • @dharanidaran.s9063
    @dharanidaran.s9063 Před 5 dny

    W explanation

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

    Sir, your teaching is just wow wow wow

  • @situationinsights2957
    @situationinsights2957 Před 2 měsíci +1

    I tried to watch so many videos but nobody explain better then you thanks alot sir i subscribed you

  • @shubh054
    @shubh054 Před měsícem +1

    What if len(arr) == 1. For ex: if I have 1 element in arr, i.e [1] then the maxSum would be 2 (sum = sum+arr[i]). We need to cover this case as well

  • @SriAnjineyudufh-
    @SriAnjineyudufh- Před rokem +2

    Good explanation sir

    • @TAPACADEMY
      @TAPACADEMY  Před rokem +1

      Keep watching and do share our channel in your community.

  • @abdihaashin1350
    @abdihaashin1350 Před 8 měsíci +1

    i love you man. nobody will explain the way you explain

  • @anirutthsa6237
    @anirutthsa6237 Před 8 měsíci +2

    Hands off 🎉🎉🎉 sir , no words to describe your level of teaching 🎉🎉🎉🎉

  • @Lucifer-jl9vh
    @Lucifer-jl9vh Před 3 měsíci +1

    Excellent explanation sir

  • @namratasingh711
    @namratasingh711 Před 8 měsíci

    You made DSA easy to understand. Excellent video!

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

    God complex teaching skills , MAD RESPECT 🙏

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

    thnaks for the help
    @TAP ACADEMY
    actully i learn lot of topics from your channnel
    but here u should take -> sum value as (0),, other wise it will add sum's value with max_sum's value and give the wrong answer

  • @jasper5016
    @jasper5016 Před 9 měsíci

    You are fantastic. It could have never been easy. Thanks so much.

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

    Amazing explanation!!! SUBSCRIBED!!!!

  • @DSApotd
    @DSApotd Před rokem

    Awesome ! explanation sir

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

    Sir your teaching speed resonates with my interpreting speed

  • @sairamthimmisetty1583
    @sairamthimmisetty1583 Před 9 měsíci

    I loved the way, he is explaining. A unique way of teaching, which is more understandable. Thank you, sir.

  • @namratasingh711
    @namratasingh711 Před 8 měsíci

    Superb ..Unique way of teaching 👏👏

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

    thank you so much sir,you are explaining very well

  • @yaswanthreddy2623
    @yaswanthreddy2623 Před 5 měsíci

    what a explanation sir. Easiest one.

  • @RabiyaBasri-qy4lb
    @RabiyaBasri-qy4lb Před 4 měsíci

    wow such a great explanation

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

    Such a good explanation

  • @shivamgupta-yz6pc
    @shivamgupta-yz6pc Před 11 měsíci

    thank you soo much sir❤

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

    Very very good explanation

  • @kavitadurge3384
    @kavitadurge3384 Před 9 měsíci

    Hats off, I have become fan of you teaching bro 🙏

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

    The best sir to teach the coding and to understand it
    Thank you sir

  • @ABDULKALAM-ig2dd
    @ABDULKALAM-ig2dd Před 11 měsíci

    Nice clear explanation ❤

  • @RS-vu5um
    @RS-vu5um Před 5 měsíci

    Excellent explanation

  • @sarthikbangroo6097
    @sarthikbangroo6097 Před 5 měsíci

    Sir Your Explanation is WOW Thankyou so much Sir ❤

  • @charizard782
    @charizard782 Před rokem

    Wonderful session sir ..
    Thanks soo much ..

    • @TAPACADEMY
      @TAPACADEMY  Před rokem

      Always welcome. Do subscribe to the channel.

  • @balusekhar
    @balusekhar Před rokem

    Thank you is all I can say

  • @kenwaybinks4223
    @kenwaybinks4223 Před rokem

    Watched many videos to understand the intuition behind it........but this is by far the best explanation for kadane's algo....rohit sir🤙🔥

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

    thanku sir you solve my dry run problem very well:)

  • @jonu.1504
    @jonu.1504 Před 6 měsíci

    You got subscriber. Thanks.

  • @user-zf7hq4yk4c
    @user-zf7hq4yk4c Před 9 měsíci

    coolest Explanation ever!!period
    \

  • @mk6263
    @mk6263 Před rokem +1

    Sir plz continue the lectures sir humble request🙏

  • @LalitSharma-vo2dr
    @LalitSharma-vo2dr Před 6 měsíci

    209. Minimum Size Subarray Sum please make video on this leet code question

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

    Nice explanation sir 🎉❤❤

  • @afreedpasha7949
    @afreedpasha7949 Před rokem

    Sir I have no words to put up you are just amazing and I'll start watching the whole series from beginning, maza aagaya dekh k so curious to watch this playlist from beginning though I know most of the concepts. Amazing delivery of the content!!!

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

    loved ur level of teaching ... very well explained sir 😁😁

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

    Superb sir❤

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

    The best video ever seen

  • @srishtisuman4919
    @srishtisuman4919 Před rokem

    Sir ur way of explanation is very easy to understand .

    • @TAPACADEMY
      @TAPACADEMY  Před rokem

      Thanks and welcome. Subscribe to the channel for regular tips.

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

    OMG you are genius man

  • @BeingShortlyApt
    @BeingShortlyApt Před měsícem +1

    How are you inside the computer😭

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

    Best explanation sirr ❤ well said about Gujaratis 🥂😎

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

    Beautiful masterful glorious ❤❤

  • @ranurautray508
    @ranurautray508 Před rokem

    sir please upload questions on substring and hashmap

  • @charizard782
    @charizard782 Před rokem

    Sir please update the next videos .
    You have not applied the videos from 2 days .

    • @TAPACADEMY
      @TAPACADEMY  Před rokem +2

      There was some problem. From today we will upload lectures again and will cover two lectures per day to cover up the missed classes.

    • @Sabh00
      @Sabh00 Před rokem +1

      Thank you so much sir for your beautiful teaching style

  • @STFK101
    @STFK101 Před rokem

    hi im plusone student usefull videos thanks bro

  • @Sabh00
    @Sabh00 Před rokem

    Now waiting for majority element

  • @VirajGund-yu1vl
    @VirajGund-yu1vl Před rokem

    sir you are not uploading videos in last 2 days why

    • @TAPACADEMY
      @TAPACADEMY  Před rokem

      There was some problem. From today we will upload lectures again and will cover two lectures per day to cover up the missed classes.

  • @mk6263
    @mk6263 Před rokem

    Sir plz explain max triplet sum sir

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

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

    class Solution {
    public int maxSubArray(int[] nums) {
    if (nums == null || nums.length == 0) {
    return 0;
    }
    if(nums.length == 1){
    return nums[0];
    }
    int sum = nums[0];
    int maxSum = nums[0];
    for(int i=1;i= 0){
    sum += nums[i];
    }else{
    sum = nums[i];
    }
    if(sum > maxSum){
    maxSum = sum;
    }
    }
    return maxSum;
    }
    }