We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent b5a02a1 commit b91bfe0Copy full SHA for b91bfe0
Easy_492_Construct_the_Rectangle.js
@@ -28,6 +28,13 @@
28
* @param {number} area
29
* @return {number[]}
30
*/
31
-var constructRectangle = function(area) {
+var constructRectangle = function (area) {
32
33
-};
+ var w = Math.floor(Math.sqrt(area));
34
+ while (area % w != 0) w--;
35
+ return [area / w, w];
36
+
37
+};
38
39
+console.log(constructRectangle(4));
40
+console.log(constructRectangle(17));
0 commit comments