You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where import Data.List (sort) solve :: [Integer] -> Integer solve = minimum . map abs . (zipWith (-) <*> tail) . sort main :: IO () main = getLine >> getLine >>= print . solve . map read . words
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Minimum Absolute Difference in an Array
You are viewing a single comment's thread. Return to all comments →
Haskell