Company: Rippling_28nov
Difficulty: medium
Array Journey Problem Description Find the maximum possible sum by traversing an array from start to end. A cursor begins at the first position of the array, with the initial sum equal to the value at that position. The cursor can move 1 to maxStep positions to the right in each step. At each step, add the value of the array element at the new cursor position to the running sum. The goal is to reach the end of the array with the maximum possible sum. Example path = [10, 2, -10, 5, 20] maxStep = 2 Start at path[0] with sum = 10 Move 1 position right (better than 2) to reach path[1] , adding 2 to sum = 12 Move 2 positions right (better than 1) to reach path[3] , adding 5 to sum = 17 Move 1 position right to reach path[4] , adding 20 to sum = 37 The maximum possible sum is 37. Function Description Complete the function journey in the editor with the following parameter(s): int path[n] : the array to traverse int maxStep : the maximum step length Returns long : maximum attainable sum Const