(int[] nums)
| 1 | |
| 2 | class Solution { |
| 3 | public int waysToSplitArray(int[] nums) { |
| 4 | long right = 0; |
| 5 | long left = 0; |
| 6 | for(int num : nums){ |
| 7 | right += num; |
| 8 | } |
| 9 | int n = nums.length; |
| 10 | int count=0; |
| 11 | for(int i=0;i<n-1;i++){ |
| 12 | left += nums[i]; |
| 13 | right -= nums[i]; |
| 14 | if(left >= right){ |
| 15 | count++; |
| 16 | } |
| 17 | } |
| 18 | return count; |
| 19 | } |
| 20 | } |
| 21 | |
| 22 | //only left sum |
nothing calls this directly
no outgoing calls
no test coverage detected