I was given 1423. Maximum Points You Can Obtain from Cards. and then with the follow up: With weight.
for example :
cardPoints = [5, 6,1,4, 2, 1, 3], k = 3, weight = [1, 10, 2, 2, 3, 100, 5]. One step, you can take one card from the beginning or from the end of the row. You have to take exactly k cards.
the answer should be : 3 * 5 + 1 * 100 + 2 * 3 = 121