(int[] nums)
| 2 | |
| 3 | class Solution { |
| 4 | public int maxSubArray(int[] nums) { |
| 5 | int maxCurrent = nums[0]; |
| 6 | int maxGlobal = nums[0]; |
| 7 | |
| 8 | for (int i = 1; i < nums.length; i++) { |
| 9 | maxCurrent = Math.max(nums[i], maxCurrent + nums[i]); |
| 10 | if (maxCurrent > maxGlobal) { |
| 11 | maxGlobal = maxCurrent; |
| 12 | } |
| 13 | } |
| 14 | |
| 15 | return maxGlobal; |
| 16 | } |
| 17 | } |
nothing calls this directly
no outgoing calls
no test coverage detected