-
Completed at: 2023-09-18T08:04:28.352Z
-
Completed languages: javascript
-
Tags: Algebra, Mathematics, Fundamentals
-
Rank: 8 kyu
Given an unsorted array of 3 positive integers [ n1, n2, n3 ]
, determine if it is possible to form a Pythagorean Triple using those 3 integers.
A Pythagorean Triple consists of arranging 3 integers, such that:
a2 + b2 = c2
[5, 3, 4] : it is possible to form a Pythagorean Triple using these 3 integers: 32 + 42 = 52
[3, 4, 5] : it is possible to form a Pythagorean Triple using these 3 integers: 32 + 42 = 52
[13, 12, 5] : it is possible to form a Pythagorean Triple using these 3 integers: 52 + 122 = 132
[100, 3, 999] : it is NOT possible to form a Pythagorean Triple using these 3 integers - no matter how you arrange them, you will never find a way to satisfy the equation a2 + b2 = c2
- For Python: return
True
orFalse
- For JavaScript: return
true
orfalse
- Other languages: return
1
or0
or refer to Sample Tests.