Construct the Rectangle LeetCode solution in JavaScript

1
/**
2
* @param {number} area
3
* @return {number[]}
4
*/
5
var constructRectangle = function (area) {
6
let w = Math.floor(Math.sqrt(area));
7
while (area % w != 0) w--;
8
return [area / w, w];
9
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0