Skip to content

Commit 17e7cc3

Browse files
authored
Update confusing-number-ii.py
1 parent dfe2aec commit 17e7cc3

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

Python/confusing-number-ii.py

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Time: O(logn)
2-
# Space: O(logn
2+
# Space: O(logn)
33

44
class Solution(object):
55
def confusingNumberII(self, N):
@@ -28,7 +28,7 @@ def totalCount(N):
2828
p //= len(lookup)
2929
return total
3030

31-
def lessValidCount(N):
31+
def validCountInLessLength(N):
3232
s = str(N)
3333
valid = 0
3434
total = len(centers)
@@ -44,7 +44,7 @@ def lessValidCount(N):
4444
total *= len(lookup)
4545
return valid
4646

47-
def equalValidCount(N):
47+
def validCountInFullLength(N):
4848
s = str(N)
4949
half_s = s[:(len(s)+1)//2]
5050
total = 0
@@ -76,5 +76,4 @@ def equalValidCount(N):
7676
p //= len(lookup)
7777
return total
7878

79-
return totalCount(N) - lessValidCount(N) - equalValidCount(N)
80-
79+
return totalCount(N) - validCountInLessLength(N) - validCountInFullLength(N)

0 commit comments

Comments
 (0)