GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — leetcode/java/724_Find_Pivot_Index.java at master · oadeniyi23/leetcode Expand file tree/ Copy path724_Find_Pivot_Index.javaMore file actions 13 lines (13 loc) · 413 Bytes / Copy path724_Find_Pivot_Index.javaFile metadata and controls13 lines (13 loc) · 413 Bytes 1 2 3 4 5 6 7 8 9 10 11 12 13 class Solution { public int pivotIndex(int[] nums) { int totalsum = 0, leftsum = 0; // Compute total sum for (int i = 0; i < nums.length; i++) totalsum += nums[i]; // Check leftsum == rightsum for (int i = 0; i < nums.length; i++) { if (leftsum == totalsum - leftsum - nums[i]) return i; leftsum += nums[i]; } return -1; } } |
| You are visitor 01402792 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |