Ad

Added tests for negative integers, modified solution so it doesn't rely on Show instance of Int.

Code
Diff
  • module AreThereThree where
    
    solution :: Int -> Bool
    solution = go . abs
      where
        go 0 = False
        go x = let (x', y) = x `divMod` 10 in y == 3 || go x'
    
    • module AreThereThree where
    • solution :: Int -> Bool
    • solution = elem '3' . show
    • solution = go . abs
    • where
    • go 0 = False
    • go x = let (x', y) = x `divMod` 10 in y == 3 || go x'