Skip to content

Commit 4807cac

Browse files
committed
daily
1 parent 3e7b369 commit 4807cac

File tree

3 files changed

+23
-0
lines changed

3 files changed

+23
-0
lines changed

my-submissions/e3461 v1.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def hasSameDigits(self, s: str) -> bool:
3+
while len(s) > 2 :
4+
s_n = []
5+
for x, y in zip(s[:-1], s[1:]) :
6+
s_n.append(str((int(x) + int(y)) % 10))
7+
s = ''.join(s_n)
8+
9+
return s[0] == s[1]

my-submissions/e3461 v2.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
class Solution:
2+
def hasSameDigits(self, s: str) -> bool:
3+
while len(s) > 2 :
4+
s = ''.join([str((int(x) + int(y)) % 10) for x, y in zip(s[:-1], s[1:])])
5+
return s[0] == s[1]
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
class Solution:
2+
def hasSameDigits(self, s: str) -> bool:
3+
a, b = 0, 0
4+
x = len(s) - 2
5+
for i, num in enumerate(s[:-1]) :
6+
a += (int(num) * comb(x, i)) % 100
7+
for i, num in enumerate(s[1:]) :
8+
b += (int(num) * comb(x, i)) % 100
9+
return a % 10 == b % 10

0 commit comments

Comments
 (0)