LeetCode Find Pivot Index Solution Explained - Java

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

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

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

    This logic also works fine
    int sum=0;
    for(int i=0;i

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

    Nice explanation! However, in the code, shouldn't line 10 be nums [i - 1] instead of nums [i]? Prefix sum is sum of all elem to left of current elem (at i). That is also the reason we check for i != 0, since there is nothing to left of 0, so we cannot do nums [0 - 1] and so we assume prefix sum = 0 in that case.

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

      depends on the requirements and constraints. Here it considers everything left from nums[0] as 0, as well as everything right from nums[nums.length - 1]

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

    Love the fact that it was actually a long explanation cause you did a great job at teaching the example at hand.

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

    No dude , no mess at all thanks if the video is still longer bt you conveyed it nicely to people.

  • @RohitKumar-vb7gt
    @RohitKumar-vb7gt 5 ปีที่แล้ว +14

    if anyone listen you carefully ,then easily understand...really very good explanation...
    bro try to upload more video(leetcode) as much as possible...

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

    You are amazing leetcoder nick.

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

    Yo Man - You are doing great and one of the best leetCoder

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

    6:56 we respect your efforts !! love you bro !! we respect you

  • @RahulSoni-br1qd
    @RahulSoni-br1qd 2 ปีที่แล้ว +1

    it's more like a stand up dude ! 😂
    but worth it

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

    I love your way of teaching Nick Love from India💙

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

    Thank you so much and for also showing your mistakes, it helps us understand better

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

    Your explanations are the best and I love you bruh (much better than neetcode), but coming directly to the total sum may be not so intuitive, was not for me. I first solved it with left to right and right to left loops.
    Then to remove the extra space, I came up with the total sum.

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

    Thanks dude, you explained very well

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

    You are the best leetcoder ever...your solutions are amazing with really good explanation!

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

    that line " iam the king of mistakes"🤣🤣🤣🤣

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

    I wasted 3 hrs in this problem. Trying to solve this

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

    I never make mistakes, which is why watch your videos.... Just kiddin' great explanation. Thanks.

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

    you are my ideal person !!!

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

    You are the best😍😌

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

    04:10 my boy is high for sure lmao

  • @guptashashwat
    @guptashashwat 3 ปีที่แล้ว

    thnx,

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

    🔥🔥🔥

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

    Luke Skywalker