Skip to content

Instantly share code, notes, and snippets.

@qoelet
Created August 28, 2013 14:59
Show Gist options
  • Save qoelet/6367009 to your computer and use it in GitHub Desktop.
Save qoelet/6367009 to your computer and use it in GitHub Desktop.
-- 3sum
type TripleInt = (Integer, Integer, Integer)
threesum :: [TripleInt] -> Integer
threesum [] = 0
threesum ((x,y,z):xs) | x + y + z == 0 = 1 + threesum xs
| otherwise = 0 + threesum xs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment