8 kyu
Pythagorean Triple
2,650 of 17,992elexie
Description:
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
Examples
[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
Return Values
- For Python: return
True
orFalse
- For JavaScript: return
true
orfalse
- Other languages: return
1
or0
or refer to Sample Tests.
Algebra
Mathematics
Fundamentals
Similar Kata:
Stats:
Created | Jun 27, 2017 |
Published | Jun 27, 2017 |
Warriors Trained | 25333 |
Total Skips | 813 |
Total Code Submissions | 55308 |
Total Times Completed | 17992 |
Java Completions | 2650 |
Python Completions | 6598 |
C++ Completions | 4294 |
JavaScript Completions | 4195 |
C Completions | 512 |
PHP Completions | 399 |
Scala Completions | 15 |
CoffeeScript Completions | 12 |
Total Stars | 152 |
% of votes with a positive feedback rating | 89% of 1752 |
Total "Very Satisfied" Votes | 1431 |
Total "Somewhat Satisfied" Votes | 263 |
Total "Not Satisfied" Votes | 58 |
Total Rank Assessments | 40 |
Average Assessed Rank | 7 kyu |
Highest Assessed Rank | 6 kyu |
Lowest Assessed Rank | 8 kyu |