Cards lie in a row, and points[i] is the value of card i. In each of k steps you take one card from either the left end or the right end. Return the maximum total you can reach.
For points = [1, 2, 3, 4, 5, 6, 1] and k = 3 the answer is 12 (the cards 1, 6, 5).
Example 1
Input:
max_points([1, 2, 3, 4, 5, 6, 1], 3)
Output:
12
Example 2
Input:
max_points([2, 2, 2], 2)
Output:
4
1 <= k <= len(points) <= 200000-10**4 <= points[i] <= 10**4No results yet
Run your code to check it against the examples, or submit to run every test.