easy c++ solution


  • 0
    vector<int> constructRectangle(int area) 
    {
        int L = (int)ceil(sqrt(area));
        while (area % L != 0)
            L++;
        
        return {L, area / L};
    }

Log in to reply
 

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