the example gives the answer [4, 3] for array [2,3,1,2,4,3] when s = 7.
can I give the answer of [3, 4], 3 is at index 1. Is that ok?
I think it should be continuous.
I tried an algorithm which sorts the array and finds the maximum numbers the sum of which is >= s. If the subarray is allowed to be noncontinuous, these numbers consist a valid solution, but OJ did not accepted it. I guess, this is because that the (indices of the) numbers are not continuous.
Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.