Haskell Perm Missing Element
import Data.List (sort)
permMissingElement :: [Int] -> Int
permMissingElement a = go (zip [1 ..] (sort a))
where
go [] = length a + 1
go ((expected, v) : rest)
| v /= expected = expected
| otherwise = go rest
This uses the expected sum of 1..N+1 and subtracts the actual sum to find the missing value.