Skip to content

Commit c7e4d70

Browse files
Added solutions
1 parent b1811ee commit c7e4d70

File tree

2 files changed

+27
-0
lines changed

2 files changed

+27
-0
lines changed

Diff for: 620.sql

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Runtime: 139 ms, faster than 60.43% of MySQL online submissions for Not Boring Movies.
2+
# Difficulty: Easy
3+
4+
SELECT * FROM cinema
5+
WHERE id % 2 = 1 AND description <> 'boring'
6+
ORDER BY -rating;

Diff for: 633.py

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Runtime: 168 ms, faster than 59.75% of Python online submissions for Sum of Square Numbers.
2+
# Difficulty: Easy
3+
4+
from math import sqrt
5+
6+
class Solution(object):
7+
def judgeSquareSum(self, c):
8+
"""
9+
:type c: int
10+
:rtype: bool
11+
"""
12+
pointer_l, pointer_r = 0, round(sqrt(c))
13+
while pointer_l <= pointer_r:
14+
sum_squares = pointer_l * pointer_l + pointer_r * pointer_r
15+
if sum_squares == c:
16+
return True
17+
if sum_squares > c:
18+
pointer_r -= 1
19+
if sum_squares < c:
20+
pointer_l += 1
21+
return False

0 commit comments

Comments
 (0)