Home / Expert Answers / Computer Science / there-are-several-cards-arranged-in-a-row-and-each-card-has-an-associated-number-of-points-the-pa267

(Solved): There are several cards arranged in a row, and each card has an associated number of points. The ...



There are several cards arranged in a row, and each card has an associated number of points. The points are given in the integer array cardPoints.In one step, you can take one card from the beginning or from the end of the row. You have to take exactly k cards.Your score is the sum of the points of the cards you have taken.Given the integer array card Points and the integer k, return the maximum score you can obtain.Example 1:Input: cardPoints = [1,2,3,4,5,6,1], k = 3Output: 12Example 2: Input: card Points = [2,2,2], k = 2Output: 4.Example 3: Input: card Points = [9,7,7,9,7,7,9], k = 7Output: 55 code



We have an Answer from Expert

View Expert Answer

Expert Answer


We have an Answer from Expert

Buy This Answer $5

Place Order

We Provide Services Across The Globe