#114

  Рет қаралды 1,323

Placements Ready with Avinash

Placements Ready with Avinash

Күн бұрын

Пікірлер: 18
@shameem.pullaratt
@shameem.pullaratt Жыл бұрын
At 8:25, Is the rightSum = totalSum - a[i] - leftSum ?
@PlacementsReady
@PlacementsReady Жыл бұрын
Yes please go through full video u will get it
@BhavanaBharatiSingh
@BhavanaBharatiSingh 5 ай бұрын
@@PlacementsReady but it wont work it we have first position as equilibrium point for e.g: 1,0 so we need to use rightsum = totalsum - a[i], leftsum += a[i] and consdition to return is if leftsum == rightsum-a[i]
@riyasingh6864
@riyasingh6864 Жыл бұрын
Very good explaination
@PlacementsReady
@PlacementsReady Жыл бұрын
Thanks Riya. Glad that you liked it.
@farhanmuhamed392
@farhanmuhamed392 Жыл бұрын
Two pointer method is more optimised, only takes O(n) time instead of O(2n)
@cosmosXverse
@cosmosXverse Жыл бұрын
can you explain little bit...about two pointer method
@PlacementsReady
@PlacementsReady Жыл бұрын
@farhanmuhamed392 how are you solving this question using two pointer approach?
@farhanmuhamed392
@farhanmuhamed392 Жыл бұрын
@@PlacementsReady int equilibriumPoint(long long a[], int n) { int left=0, right=n-1; long long sumLeft=a[left], sumRight=a[right]; while(left != right){ if(sumLeft > sumRight){ right--; sumRight = sumRight + a[right]; } else{ left++; sumLeft = sumLeft + a[left]; } } if( sumLeft == sumRight) return left+1; else return -1; }
@farhanmuhamed392
@farhanmuhamed392 Жыл бұрын
@@cosmosXverse Declare 4 variables left, right, leftSum, rightSum left and right are pointers , and leftSum and rightSum keep track sum of value at current pointers int equilibriumPoint(long long a[], int n) { int left=0, right=n-1; long long sumLeft=a[left], sumRight=a[right]; while(left != right){ if(sumLeft > sumRight){ right--; sumRight = sumRight + a[right]; } else{ left++; sumLeft = sumLeft + a[left]; } } if( sumLeft == sumRight) return left+1; else return -1; }
@pranavmittal2976
@pranavmittal2976 Жыл бұрын
@@farhanmuhamed392 bro it is failing for the test case 1 2 0 3 it expected output is 3 but it is printing -1
#115 GFG POTD Find duplicates in an array GeeksForGeeks Problem of the Day | PlacementsReady
8:33
Leaders in an Array | Brute - Optimal | Strivers A2Z DSA Course
11:53
take U forward
Рет қаралды 151 М.
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 6 МЛН
快乐总是短暂的!😂 #搞笑夫妻 #爱美食爱生活 #搞笑达人
00:14
朱大帅and依美姐
Рет қаралды 14 МЛН
One day.. 🙌
00:33
Celine Dept
Рет қаралды 67 МЛН
How to Fight a Gross Man 😡
00:19
Alan Chikin Chow
Рет қаралды 21 МЛН
Mission: Possible: Building a better business
33:15
Underpin Consultants
Рет қаралды 1,6 М.
Find equilibrium point in an array
10:32
Techdose
Рет қаралды 58 М.
Beat Ronaldo, Win $1,000,000
22:45
MrBeast
Рет қаралды 105 МЛН
PROBLEM OF THE DAY: 18/08/2023 | Leaders in an Array | GeeksforGeeks Practice
11:00
ML Was Hard Until I Learned These 5 Secrets!
13:11
Boris Meinardus
Рет қаралды 343 М.
What P vs NP is actually about
17:58
Polylog
Рет қаралды 137 М.
Deadpool family by Tsuriki Show
00:12
Tsuriki Show
Рет қаралды 6 МЛН