|
| 1 | +What's the biggest sum you can get from adding 5 consecutives integers in a array? |
| 2 | + |
| 3 | +Example: |
| 4 | + Array = [1, 3, -2, 4, -9, 1, 4, 7] |
| 5 | + Possibles Sums: |
| 6 | + 1 + 3 + (-2) + 4 + (-9) = -3 |
| 7 | + 3 + (-2) + 4 + (-9) + 1 = -3 |
| 8 | + (-2) + 4 + (-9) + 1 + 4 = -2 |
| 9 | + 4 + (-9) + 1 + 4 + 7 = 7 |
| 10 | + |
| 11 | + So the biggest Sum is 7. |
| 12 | + |
| 13 | +What's the biggest sum of 5 consecutives integers of the array below? |
| 14 | + |
| 15 | +Array = [1, 3, -5, 8, -9, 13, -2, -3, 8, 4, 3, 6, 1, 2, -2, -4, 8, -4, 1, 8, 2, 1, 3, 1, 2, 3, |
| 16 | + 7, 8, -9, 5, 4, 3, 2, 4, 1, 2, 6, 6, 7, -15, 9, 7, 8, 16, -10, 1, 2, 6, 6, 4, -5, 2, 2 |
| 17 | + 3, 6, 7, 8, 1, 2, 3, 3, 4, 5, 6, 1, -5,7, -9, 10, 1, 3, 4, 8, 7, 6, 4, 1, 1, 2, 3, 1] |
| 18 | + |
| 19 | +PS: There may or may not have different sequences that has the same sum. |
0 commit comments