Question: Please in Python 5;} Array Journey You are standing at the start of an array of integers. You want to move to the end of
Please in Python

5;} Array Journey You are standing at the start of an array of integers. You want to move to the end of the array, collecting as many points as possible along the way. Each step can cover a maximum number of elements Each time you land on an element, its value is added to your score' What is the maximum score achievable? For example, you are at position 0 of the array path = [10, 2, -10, 5, 20]' Your maximum step can cover k=2 elements Your score starts at 10, the value at index 0' Your first step could land you on elements valued 2 or-10t You choose to land on 2to achieve the higher score, now 10+2=12t Next you choose between landing on -10 or 5' You choose 5 for a score of 12+5=17o You make one final move to your goal and your total score is 17+20=37. Function Description Complete the functionjourney in the editor below The function must return a long integer denoting your maximum attainable scores journey has the following parameter(s): path[path[0],u.path[n 1]]: an array of integers k: an integer, the maximum step length Constraints - 195105 0 0 s|path[i]|s105, where 0 s i Input Format for Custom Testing V Sample Case 0 Sample Input 0 3 10 20 5 2 Sample Output 0 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
