Erlang Perm Check
-module(perm_check).
-export([perm_check/1]).
perm_check(A) ->
Sorted = lists:sort(A),
Indexed = lists:zip(lists:seq(1, length(Sorted)), Sorted),
case lists:all(fun({I, V}) -> I =:= V end, Indexed) of
true -> 1;
false -> 0
end.
This validates that every value from 1 to N appears exactly once.