MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given a vector of lengths [a b c], determines whether a triangle with non-zero area (in two-dimensional Euclidean space, smarty!) could have sides of those lengths.

Examples:

[1 2 1000] ---> false

[3 4 5] ---> true

[5 5 5] ---> true

364 correct solutions
332 incorrect solutions

Last solution submitted on Aug 28, 2015

1 player likes this problem

1 Comment

Binbin Qi
on 25 Apr 2012

no range??

1 Comment

Peter Wittenberg
on 31 Mar 2012

I wanted to try out the Hankel here. This is more than necessary. It checks to see that the sum of all pairs of sides are greater than the remaining side. You really only need to do this to compare against the maximum length side.

3 Comments

Yvan Lengwiler
on 1 Mar 2012

This is just bad, only gaming the test suit. There is nothing to be learned from this.

MD. MASRUL HUDA
on 23 Jun 2012

worst solution ,i have ever seen

the cyclist
on 9 Mar 2013

Added to test suite to eliminate this "solution".

1 Comment