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)


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