Construct the Rectangle LeetCode solution in C++

1
class Solution {
2
public:
3
vector<int> constructRectangle(int area) {
4
int sq = sqrt(area);
5
while (sq > 1) {
6
if (area % sq == 0) break;
7
sq--;
8
}
9
return {area / sq, sq};
10
}
11
};

0

WPM •0 •0

100%

ACC •0 •0

0s

TIME •0