Given an unsorted set A
what is the most efficient solution
for finding the smallest integer x
which is not element of A
such that x
needs to be larger than some integer m
?
e.g.
Input: A = {7, 3, 4, 1}
, m = 5
Output: x = 6
I'm searching for solution in C, but any kind of pseudocode would be helpful... Can this problem be solved in O(n) where n is the set size?