Amazon interview question

Had to do a coding assessment which was two coding problems. One was on largest subarray combination that equaled a value. The other was an array of numbers and you need to create a new sub array with maximum combination so that the amounts out of the original array increases at least 1 each step ie [5,4,3,3, 5] the max subarray is [1,2,3] another is [3,5] which gives max 8.