leetcode

Solution to some Leetcode problems written in C++
git clone git://git.dimitrijedobrota.com/leetcode.git
Log | Files | Refs | README | LICENSE

0492.cpp (254B)


0 class Solution { 1 public: 2 vector<int> constructRectangle(int area) const { 3 for (int w = sqrt(area); w > 0; w--) { 4 const int l = area / w; 5 if (l * w == area) return {l, w}; 6 } 7 8 return {-1, -1}; 9 } 10 };