leetcode

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

commit677bb7f7619c3af34b290aeb06db33da24d26e75
parentfe72b05c2d9a181e2d96cd5cacd45e0a5b8a0b99
authorDimitrije Dobrota <mail@dimitrijedobrota.com>
dateMon, 17 Jun 2024 11:09:56 +0200

Daily Problem

Diffstat:
AProblems/0633.cpp|+++++++++++++++++
MREADME.md|+

2 files changed, 18 insertions(+), 0 deletions(-)


diff --git a/Problems/0633.cpp b/Problems/0633.cpp

@@ -0,0 +1,17 @@

class Solution {
public:
bool judgeSquareSum(const int c) const {
long left = 0, right = sqrt(c);
while (left <= right) {
const long mid = left * left + right * right;
if (mid == c) return true;
if (mid < c)
left++;
else
right--;
}
return false;
}
};

diff --git a/README.md b/README.md

@@ -429,6 +429,7 @@ for solving problems.

| 0626 | Medium | [Exchange Seats](Problems/0626.cpp) |
| 0627 | Easy | [Swap Salary](Problems/0627.cpp) |
| 0629 | Hard | [K Inverse Pairs Array](Problems/0629.cpp) |
| 0633 | Medium | [Sum of Square Numbers](Problems/0633.cpp) |
| 0636 | Medium | [Exclusive Time of Functions](Problems/0636.cpp) |
| 0637 | Easy | [Average of Levels in Binary Tree](Problems/0637.cpp) |
| 0638 | Medium | [Shopping Offers](Problems/0638.cpp) |