Skip to content

Instantly share code, notes, and snippets.

@Neo-J
Created November 12, 2013 03:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Neo-J/828b8daa1d4c34fa7dac to your computer and use it in GitHub Desktop.
Save Neo-J/828b8daa1d4c34fa7dac to your computer and use it in GitHub Desktop.
test for v2ex
def triangle(a, b, c)
raise TriangleError if [a,b,c].min <= 0
x, y, z = [a,b,c].sort
raise TriangleError if x + y <= z
[:equilateral,:isosceles,:scalene].fetch([a,b,c].uniq.size - 1)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment