Problem 2022. Find a Pythagorean triple
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 .
Solution Stats
Problem Comments
-
8 Comments
Show
5 older comments
Jean-Marie Sainthillier
on 13 Dec 2013
See Problem 1550 Can I make a right triangle ?
Justin Illingworth
on 22 Oct 2019
Thanks Tanya, have enjoyed these.
George Iskander
on 18 Feb 2020
if (a==2|a==3)
flag=true;
end
The cases are very limited to make such a code valid
Lkhagvasuren Byambadorj
on 27 Oct 2020
Thanks, enjoyed these.
Parry
on 11 Dec 2022
I really liked this problem!
Minh Lan
on 20 Feb 2023
niceee
Shahriar Kabir
on 19 Mar 2023
brainstormed
Josh
on 17 Jul 2023
any insight into handling the case where one of the side lengths is irrational and rounding error in the approximation causes a false negative to be returned?
for example - Test 7
Solution Comments
Show commentsProblem Recent Solvers4150
Suggested Problems
-
Determine whether a vector is monotonically increasing
18630 Solvers
-
Back to basics 9 - Indexed References
432 Solvers
-
Make a run-length companion vector
625 Solvers
-
964 Solvers
-
560 Solvers
More from this Author10
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!