Here is the solution to "Find Pivot index " leetcode question. Hope that you will like the way I have explained the solution.
Given an array of integers nums, calculate the pivot index of this array.
The pivot index is the index where the sum of all the numbers strictly to the left of the index is equal to the sum of all the numbers strictly to the index's right.
If the index is on the left edge of the array, then the left sum is 0 because there are no elements to the left. This also applies to the right edge of the array.
Return the leftmost pivot index. If no such index exists, return -1.
Link to my github repository to get the code
https://github.com/architagr/leetcode...
Link to the Prefix sum or the running sum of 1d array question: • #Leetcode #1480 Running Sum of 1d Arr...
******* Table of content *******
00:00 Understanding the problem statement
02:54 understanding problem with an example
08:34 Brute force approach
12:29 Time complexity of brute force approach
14:54 Understand how to optimize brute force approach
20:18 Dry run of optimized approach
28:16 Algo
31:51 find time and space complexity of the algo
33:07 Final code in Golang
38:00 Thank you
Facebook Coding Interview question,
google coding interview question,
leetcode,
find pivot index
find pivot index Golang
#leetcode #leetcodesolution #Amazon #Facebook #CodingInterview #LeetCode #Google #724 #golang #go #amzon #facebook #google #findpivotindex