Hint | Answer | % Correct |
---|---|---|
f :: [Int] -> [Int] f = map (*10) | Multiplies every element in a list of integers by 10 | 89%
|
f :: String -> String f [] = [] f (x:xs) | isUpper x = x : f xs | otherwise = f xs | Discards all chars in a string that aren't uppercase letters | 78%
|
f :: Int -> Int f 1 = 1 f 2 = 1 f n = f (n-1) + f (n-2) | Computes any number in the Fibonacci sequence | 67%
|
f :: [Int] -> Int f [] = 0 f (x:xs) | even x = x + f xs | otherwise = f xs | Computes the sum of all even numbers in a list of integers | 67%
|
f :: [Int] -> Int f [] = 0 f (x:xs) | odd x = x + f xs | otherwise = f xs | Computes the sum of all odd numbers in a list of integers | 67%
|
f :: Eq a => [a] -> a -> Int f [] _ = 0 f (x:xs) y | y == x = 1 + f xs y | otherwise = f xs y | Counts the number of occurrences of a value in a list | 67%
|
f :: Int -> Int -> Maybe Int f _ 0 = Nothing f x y = Just (x `div` y) | Performs integer division, with a check for division by zero | 67%
|
f :: Int -> [Int] f x = [y | y <- [1..x], x `mod` y == 0] | Computes all the factors of an integer | 56%
|
f :: Int -> Int f 0 = 1 f n = n * f (n-1) | Computes the factorial of a number | 56%
|
f :: Int -> String f 0 = "0" f 1 = "1" f n = f (n `div` 2) ++ f (n `mod` 2) | Returns the binary representation of a number | 44%
|
Copyright H Brothers Inc, 2008–2024
Contact Us | Go To Top | View Mobile Site