Maximum Points You Can Obtain Problem

Maximum Points You Can Obtain Problem — ExecCode Easy DSA Practice

Solve the Maximum Points You Can Obtain problem on ExecCode. Free online easy DSA practice in Sliding Window. Write and run code in Java, C++, Python — no signup required to run.

Problem description

Description You are given the input needed to solve Maximum Points You Can Obtain. Your task is to compute the required answer and return maximum sum of k end cards. A sequence of values is given, and order matters. In Maximum Points You Can Obtain, the goal is to transform, count, or select values according to the exact rule. Line 1: n k; line 2: card point values.

Examples

Input {"cardPoints": [1, 2, 3, 4, 5, 6, 1], "k": 3}; Output 12

Constraints

1 <= k <= n

Practice Maximum Points You Can Obtain free on ExecCode. Browse DSA problems, topic map, and placement guides.