Given an array, for instance [1,5,6,7,5,10,4,2], you can pick K number , and each time you can only pick from the front or back, after each pick, that number will be erased from the array. For instance, k =3, the max pick sum is 2+4+10 = 16. Find the max sum given array and K