Leetcode 724 | Find pivot index | 19th from LC 75 | 90 days SE prep

Поділитися
Вставка
  • Опубліковано 12 вер 2024

КОМЕНТАРІ • 21

  • @shogunkodogun
    @shogunkodogun 2 місяці тому

    class Solution {
    public:
    int pivotIndex(vector& nums) {
    int totalSum = 0;
    int i = 0;
    while (i < nums.size()) {
    totalSum += nums[i];
    ++i;
    }
    int leftSum = 0;
    i = 0;
    while (i < nums.size()) {
    int rightSum = totalSum - (leftSum + nums[i]);
    if (leftSum == rightSum) {
    return i;
    }
    leftSum += nums[i];
    ++i;
    }
    return -1;
    }
    };

  • @mrsingh5351
    @mrsingh5351 3 місяці тому

    Awesome

  • @MagicDiamondUniverse
    @MagicDiamondUniverse 8 місяців тому +2

    Why have you stopped making videos?

    • @Pepcoding
      @Pepcoding  8 місяців тому +2

      Was on a week vacation for new year. It restarts tomorrow morning.

  • @aasminkainth1394
    @aasminkainth1394 8 місяців тому

    Good Luck sir! Nice content again..

  • @prashantgupta6160
    @prashantgupta6160 8 місяців тому +1

    Happy new year sumeet sir 🎉
    Waiting for next videos

    • @Pepcoding
      @Pepcoding  8 місяців тому +1

      Starting today

  • @DheerajKapoor-km3vb
    @DheerajKapoor-km3vb 4 місяці тому

    Hi, Can you please tell which software is this, which you are using for digital writing?
    I need that urgently.

  • @im_heretic
    @im_heretic 8 місяців тому

    Sir apse ek chota sa doubt tha ...
    Like i have no interest in competitive programming but i have intrest in open source o should i prefer java over c++ for placements and internship for upcoming time as i am currently in 3rd sem along with javascript for contributions

  • @unemployedcse3514
    @unemployedcse3514 8 місяців тому

    Awesome ❤

  • @Riyal_batman
    @Riyal_batman 8 місяців тому

    Bhai jese factorial ka karte hai wese ek index ke aage ke saare index and pichhe ke saare index ko sum kar de to kesa rahega
    Like ek main index let 3 in this case, uske pichhe ke saare index i.e 0,1,2 ka sum and aageke saare index ka sum 4,5 agar equal aaya then print karega pivot index

  • @rohankarmakar1761
    @rohankarmakar1761 5 місяців тому

    Equilibrium point GFG

  • @codingwithaman4611
    @codingwithaman4611 8 місяців тому

    Yes,why have you stopped? Kindly make it even if there was a gap. RESTART.

    • @Pepcoding
      @Pepcoding  8 місяців тому +1

      Hanji. I will restart today.

  • @lingraj6049
    @lingraj6049 8 місяців тому

    Bhaiya kal se video nhi aaya hai😢

  • @prashant.s.397
    @prashant.s.397 8 місяців тому

    sir kya hua sde prep band hogayi kya

  • @MagicDiamondUniverse
    @MagicDiamondUniverse 8 місяців тому

    Why have you stopped making videos?