solution.hs 341 B

1234567891011
  1. -- https://www.codewars.com/kata/5679aa472b8f57fb8c000047
  2. module Codewars.G964.FindEven where
  3. findEvenIndex :: [Int] -> Int
  4. findEvenIndex arr = findEvenIndexImpl [] 0 arr
  5. findEvenIndexImpl left n right
  6. | right == [] = -1
  7. | sum left == sum (tail right) = n
  8. | otherwise = findEvenIndexImpl (left ++ [head right]) (n + 1) (tail right)