JS solution


  • 1
    var constructRectangle = function(area) {
        let w = Math.floor(Math.sqrt(area));
        while (area % w !== 0) {
            w--;
        }
        return [area / w, w];
    };
    

Log in to reply
 

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.