leetcode

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

0633.cpp (375B)


0 class Solution {
1 public:
2 bool judgeSquareSum(const int c) const {
3 long left = 0, right = sqrt(c);
5 while (left <= right) {
6 const long mid = left * left + right * right;
7 if (mid == c) return true;
8 if (mid < c)
9 left++;
10 else
11 right--;
12 }
14 return false;
15 }
16 };