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

Learn moreOpportunities for recent engineering grads.

Apply Today**New to MATLAB?**

Given four different positive numbers, a, b, c and d, provided in increasing order: a < b < c < d, find if any three of them comprise sides of a right-angled triangle. Return **true** if they do, otherwise return **false** .

289 correct solutions
207 incorrect solutions

Last solution submitted on Apr 27, 2015

1 player likes this problem

1 Comment

Niels
on 24 Apr 2015 at 10:31

Should work for any case and doesn't contain str2num or regexp :)

1 Comment

Anupam Agarwal
on 8 Oct 2014

Fifth test cannot be true because 3.5^2 = 12.25
and no integer after squaring and adding will give such result

3 Comments

Jon
on 6 Dec 2013

Still without str2num or regexp

Alfonso Nieto-Castanon
on 8 Dec 2013

this would fail on assert(isequal(isTherePythagoreanTriple(1,4,7,9),false))

Jon
on 9 Dec 2013

The benefit of a limited test suite.

1 Comment

Jon
on 2 Dec 2013

Without using str2num or regexp

1 Comment