HackerRank Problem Link
JS Solution
const [area, perimeter] = expressions; // ES6 destructuring const s1 = (perimeter + Math.sqrt(Math.pow(perimeter, 2) - 16 * area)) / 4; const s2 = (perimeter - Math.sqrt(Math.pow(perimeter, 2) - 16 * area)) / 4; return [s1, s2].sort();
Last updated 3 years ago
Was this helpful?