Max Prefix MEX
Given an array A of N non-negative integers. Find the maximum K such that there exists a permutation of A for which the set of its prefix sums contains all integers 0, 1, ..., K-1. Input: N followed by N integers. Output: Single integer K.
3
0 1 323
1 2 30
0
0%
1