DEV Community

loading...

Discussion on: Daily Challenge #218 - Possible Sides of a Non-Right Triangle

Collapse
windeep profile image
windeep

Ruby solution

def side_len(a,b)
  (((a-b).abs+1)...(a+b)).reject { |x| x*x + a*a == b*b || x*x == a*a +b*b }
end
Forem Open with the Forem app