Skip to content

Latest commit

 

History

History
27 lines (18 loc) · 524 Bytes

File metadata and controls

27 lines (18 loc) · 524 Bytes

Back

Array Max Consecutive Sum

https://app.codesignal.com/arcade/intro/level-8/Rqvw3daffNE7sT7d5

Challenge description

Given array of integers, find the maximal possible sum of some of its k consecutive elements.

Example

For inputArray = [2, 3, 5, 1, 6] and k = 2, the output should be solution(inputArray, k) = 8. All possible sums of 2 consecutive elements are:

2 + 3 = 5;
3 + 5 = 8;
5 + 1 = 6;
1 + 6 = 7.
Thus, the answer is 8.

Solution

Solved with Rust