We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Non-generate triangle happens when a side of triangle exceed the sum of the other 2 sides. Imagine a triangle with side of 1, 1, and 2; it becomes a line, not a triangle :p. This is the function check the non-generate with input of integer a, b, c where a <= b <= c:
boolisvalid(inta,intb,intc){returna+b>c;}
then the problem become sorting followed by triangle validation.
Maximum Perimeter Triangle
You are viewing a single comment's thread. Return to all comments →
Non-generate triangle happens when a side of triangle exceed the sum of the other 2 sides. Imagine a triangle with side of 1, 1, and 2; it becomes a line, not a triangle :p. This is the function check the non-generate with input of integer a, b, c where a <= b <= c:
then the problem become sorting followed by triangle validation.