CodePudding user response:
Under the condition of no account of time space complexity, a form of thinking, try it,For each element in the original array, calculation of subarray, led by it, the minimum and the minimum and the corresponding end element position, and then start from the first element, and determine the boy array, if less than or equal to the limit, then again from the sequence to the end of the ward to find a can satisfy the allowable value of remaining subsequence, until find the subsequence, put this together string son sequence string up to the first eligible array, remove and then after the rest of the array to find qualified record, until you find all elements, or the rest of the can't find the qualified sequence in the array