Largest int from concatenated ints: Difference between revisions

m
→‎Haskell Try all permutations method: (<$> -> fmap; needs fewer brackets)
m (→‎Haskell Try all permutations method: (<$> -> fmap; needs fewer brackets))
Line 978:
<lang Haskell>import Data.List (permutations)
 
main :: IO ()
main =
print
(maxcat <$> [[1, 34, 3, 98, 9, 76, 45, 4], [54, 546, 548, 60]] :: [Integer])
where
maxcat = read . maximum . fmap (concatMap show <$>) . permutations</lang>
 
;Output as above.
9,655

edits