Ad
Code
Diff
  • module ReverseDigs where
    
    revDigs :: Integer -> Integer
    revDigs = read . rev . show
      where
        rev :: [Char] -> [Char]
        rev [] = []
        rev (x:xs) = ((rev xs) ++ [x])
    • public class Algorithms {
    • public static int reverseInt(int n) {
    • int reversed = 0;
    • while(n != 0){
    • reversed = reversed * 10 + (n % 10);
    • n /= 10;
    • }
    • return reversed;
    • }
    • }
    • module ReverseDigs where
    • revDigs :: Integer -> Integer
    • revDigs = read . rev . show
    • where
    • rev :: [Char] -> [Char]
    • rev [] = []
    • rev (x:xs) = ((rev xs) ++ [x])

Returns 100

Code
Diff
  • module Return100 where
    import Data.List
    
    returnHundred :: Integer -> Integer
    returnHundred _ = sum $ map (^3) [1..4]
    
    • function returnhundred() {
    • return 10 ** 2;
    • }
    • module Return100 where
    • import Data.List
    • returnHundred :: Integer -> Integer
    • returnHundred _ = sum $ map (^3) [1..4]