|
2 | 2 |
|
3 | 3 | /**
|
4 | 4 | * 53. Maximum Subarray
|
| 5 | + * Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. |
5 | 6 | *
|
6 |
| - * Find the contiguous subarray within an array (containing at least one number) which has the largest sum. |
7 |
| - * For example, given the array [-2,1,-3,4,-1,2,1,-5,4], the contiguous subarray [4,-1,2,1] has the largest sum = 6. |
| 7 | + * Example: |
| 8 | + * Input: [-2,1,-3,4,-1,2,1,-5,4], |
| 9 | + * Output: 6 |
| 10 | + * Explanation: [4,-1,2,1] has the largest sum = 6. |
| 11 | + * |
| 12 | + * Follow up: |
| 13 | + * If you have figured out the O(n) solution, try coding another solution using the divide and conquer approach, which is more subtle. |
8 | 14 | */
|
9 | 15 |
|
10 | 16 | publicclass_53 {
|
|