Algorithm · C3.ai · Medium
A line of cards is laid out in a row, and every card carries some number of points. You will make a sequence of moves; on each move you remove a single card, and it must come from either the leftmost or the rightmost end of whatever remains of the row. You are required to make exactly k moves. Your score is the sum of the points on all the cards you removed. Return the largest score you can achieve. Examples Example