Code
Diff
  • module MaxNum (maxNum) where
    
    import Data.List
    import Data.Ord
    
    maxNum :: Int -> Int
    maxNum = read . sortOn Down . show
    • module MaxNum (maxNum) where
    • import Data.List
    • import Data.Ord
    • maxNum :: Int -> Int
    • maxNum = read . reverse . sort . show
    • maxNum = read . sortOn Down . show
Code
Diff
  • module MaxNum (maxNum) where
    
    import Data.List
    
    maxNum :: Int -> Int
    maxNum = read . reverse . sort . show
    • module MaxNum (maxNum) where
    • import Data.List
    • import Control.Monad
    • import Data.Char
    • maxNum :: Int -> Int
    • maxNum = read . join . map show . reverse . sort . map digitToInt . show
    • maxNum = read . reverse . sort . show