Erlang Missing Integer
-module(missing_integer).
-export([missing_integer/1]).
missing_integer(A) ->
Positives = [V || V <- lists:usort(A), V > 0],
find_missing(Positives, 1).
find_missing([], Min) ->
Min;
find_missing([V | Rest], Min) ->
case V =:= Min of
true -> find_missing(Rest, Min + 1);
false -> Min
end.
This records the positive numbers that exist, then returns the smallest positive value that is still missing.