We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Update List
Update List
+ 1 comment f arr = map abs arr
+ 1 comment Here's kind of a funny solution:
main = interact $ filter (/= '-')
+ 0 comments Clojure:
(fn[lst] (map #(Math/abs %) lst))
+ 0 comments Haskell
-- Enter your code here. Read input from STDIN. Print output to STDOUT f arr = [abs x | x <- arr]-- Complete this function here -- This section handles the Input/Output and can be used as it is. Do not modify it. main = do inputdata <- getContents mapM_ putStrLn $ map show $ f $ map (read :: String -> Int) $ lines inputdata
+ 0 comments Full solution including IO-handling in F#:
Seq.initInfinite (fun _->System.Console.ReadLine()) |> Seq.takeWhile ((<>) null) |> Seq.map (int>>abs) |> Seq.iter(printfn "%d")
Load more conversations
Sort 80 Discussions, By:
Please Login in order to post a comment