We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Solved this problem in F# using Euclid's formula to generate primitive Pythagorean triplets, for each increasing the triplet count of the appropriate lenghts (ie, multiples of the sum of the triplet values). With some simple DP, one then has all answers precalculated.
Note that this last part is useful in this particular problem, since the number of tests can be high (10^5).
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Project Euler #75: Singular integer right triangles
You are viewing a single comment's thread. Return to all comments →
Solved this problem in F# using Euclid's formula to generate primitive Pythagorean triplets, for each increasing the triplet count of the appropriate lenghts (ie, multiples of the sum of the triplet values). With some simple DP, one then has all answers precalculated. Note that this last part is useful in this particular problem, since the number of tests can be high (10^5).