Find Pivot Index
Example 1:
Input: nums = [1,7,3,6,5,6]
Output: 3
Explanation:
Pivot indeksi 3 ga teng.
Left sum = nums[0] + nums[1] + nums[2] = 1 + 7 + 3 = 11
Right sum = nums[4] + nums[5] = 5 + 6 = 11Example 2:
Input: nums = [1,2,3]
Output: -1
Explanation:
Muammo bayonotidagi shartlarni qondiradigan indeks yo'q.Example 3:
Input: nums = [2,1,-1]
Output: 0
Explanation:
Pivot indeksi 0 ga teng.
Left sum = 0 (0 indeksining chap tomonida hech qanday element yo'q)
Right sum = nums[1] + nums[2] = 1 + -1 = 0Cheklovlar:
Last updated