Files
freeCodeCamp/curriculum/challenges/english/08-coding-interview-prep/project-euler/problem-39-integer-right-triangles.english.md
Valeriy 79d9012432 fix(curriculum): quotes in tests (#18828)
* fix(curriculum): tests quotes

* fix(curriculum): fill seed-teardown

* fix(curriculum): fix tests and remove unneeded seed-teardown
2018-10-20 23:32:47 +05:30

1.5 KiB

id, challengeType, title
id challengeType title
5900f3931000cf542c50fea6 5 Problem 39: Integer right triangles

Description

If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120. {20,48,52}, {24,45,51}, {30,40,50} For which value of p ≤ n, is the number of solutions maximised?

Instructions

Tests

tests:
  - text: <code>intRightTriangles(500)</code> should return 420.
    testString: assert(intRightTriangles(500) == 420, '<code>intRightTriangles(500)</code> should return 420.');
  - text: <code>intRightTriangles(800)</code> should return 420.
    testString: assert(intRightTriangles(800) == 420, '<code>intRightTriangles(800)</code> should return 420.');
  - text: <code>intRightTriangles(900)</code> should return 840.
    testString: assert(intRightTriangles(900) == 840, '<code>intRightTriangles(900)</code> should return 840.');
  - text: <code>intRightTriangles(1000)</code> should return 840.
    testString: assert(intRightTriangles(1000) == 840, '<code>intRightTriangles(1000)</code> should return 840.');

Challenge Seed

function intRightTriangles(n) {
  // Good luck!
  return n;
}

intRightTriangles(1000);

Solution

// solution required