← Back to challenges

Is This a Right Angled Triangle?

JavaScriptHardmathalgebravalidation

Instructions

Given three numbers, x, y and z, determine whether they are the edges of a right angled triangle.

Examples

rightTriangle(3, 4, 5) ➞ true
// This is the classic example of a "nice" right angled triangle.

rightTriangle(145, 105, 100) ➞ true
// This is a less famous example.

rightTriangle(70, 130, 110) ➞ false
// This isn't a right angled triangle.

Notes

  • Notice the largest side of the triangle might not be the last one passed to the function.
  • All numbers will be integers (whole numbers).
javascript
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Spicy Food