cardPoints array and store it in totalScore.k is equal to the length of cardPoints, return totalScore as all cards are taken.minSubarrayScore to totalScore.presentSubarrayScore to the sum of the first cardPoints.length - k elements.cardPoints.length - k to the end of the array.presentSubarrayScore by adding the current element and subtracting the element at the start of the current window.minSubarrayScore if presentSubarrayScore is less than the current minSubarrayScore.minSubarrayScore from totalScore to get the maximum score that can be obtained.