Leetcode 492 Solution
This article provides solution to leetcode question 492 (construct-the-rectangle)
Access this page by simply typing in "lcs 492" in your browser address bar if you have bunnylol configured.
Leetcode Question Link
https://leetcode.com/problems/construct-the-rectangle
Solution
class Solution {
public:
vector<int> constructRectangle(int area) {
int k = sqrt(area);
for (int i = k; i >= 1; --i)
{
if (area % i == 0)
return {area / i, i};
}
return {};
}
};