You are viewing a single comment's thread. Return to all comments →
Don't need integration, minima, or any such. Don't even need a queue or container, really.
Either the problem is solvable or it's not -- but the problem statement doesn't leave room for unsolvable.
Thus assuming it's solvable, and you're looking for the lowest index from which it works, vinay_star_lord's solution (which I came up with on my own) works without a container, i.e., constant space.