Free written solutionSmallest Missing Integer Greater Than Sequential Prefix Sum (LeetCode 2996): Solution and Explanation
Add up the longest prefix where each element is one more than the last, then return the smallest value at or above that sum that is not in the array.
Read the intuition, approach, code and complexity →