You are viewing a single comment's thread. Return to all comments →
Haskell
module Main where import qualified Data.Map as M missingNumbers :: [Int] -> [Int] -> [Int] missingNumbers xs ys = do let mx = M.fromListWith (+) $ zip xs $ repeat 1 let my = M.fromListWith (+) $ zip ys $ repeat 1 let diff = M.differenceWith (\y x -> if x == y then Nothing else Just (y - x)) my mx M.keys diff main :: IO () main = do _ <- getLine xs <- fmap (map read . words) getLine _ <- getLine ys <- fmap (map read . words) getLine let result = missingNumbers xs ys putStrLn $ unwords $ map show result
Seems like cookies are disabled on this browser, please enable them to open this website
Missing Numbers (FP)
You are viewing a single comment's thread. Return to all comments →
Haskell