第一题
Given an Array of bad numbers and a range of integers, how can I determine the longest segment of integers within that inclusive range that doesn't contain a bad number?
For example, you are given the lower limit l=3 and the upper limit r = 48, The array badNumbers = [37,7,22,15,49,60]. Segments without bad numbers are [3,6],[8,14],[16,21],[23,36] and [38,48]. The longest segment is [23,36] and it is 14 elements long.
Problem : Function Description Complete the function goodStatement in the editor below. The function must return an integer denoting the length of the longest contiguous range of natural number1 + 3+3+1 -2. The maximum profit is 16. Function Description Complete the function maxProfit in the editor below. The function must return the maximum profit achievable. maxProfit has the following parameters: k an integer denoting the half of the needed amount of pieces of the field. profit[profit[0],..profit[n-1].
不会发图片,放附件里
|