4
This commit is contained in:
14
solutions/lc2315.py
Normal file
14
solutions/lc2315.py
Normal file
@@ -0,0 +1,14 @@
|
||||
class Solution:
|
||||
def countAsterisks(self, s: str) -> int:
|
||||
is_count = True
|
||||
n = 0
|
||||
for i in s:
|
||||
if i == '|' and is_count == False:
|
||||
is_count = True
|
||||
elif i == '|' and is_count:
|
||||
is_count = False
|
||||
|
||||
if i == '*' and is_count:
|
||||
n += 1
|
||||
|
||||
return n
|
||||
3
solutions/lc2828.py
Normal file
3
solutions/lc2828.py
Normal file
@@ -0,0 +1,3 @@
|
||||
class Solution:
|
||||
def isAcronym(self, words: List[str], s: str) -> bool:
|
||||
return True if s == "".join(i[:1] for i in words) else False
|
||||
6
solutions/lc3931.py
Normal file
6
solutions/lc3931.py
Normal file
@@ -0,0 +1,6 @@
|
||||
class Solution:
|
||||
def isAdjacentDiffAtMostTwo(self, s: str) -> bool:
|
||||
for i in range(1, len(s)):
|
||||
if abs(int(s[i]) - int(s[i - 1])) > 2:
|
||||
return False
|
||||
return True
|
||||
9
solutions/lc961.py
Normal file
9
solutions/lc961.py
Normal file
@@ -0,0 +1,9 @@
|
||||
class Solution:
|
||||
def repeatedNTimes(self, nums: List[int]) -> int:
|
||||
temp = []
|
||||
|
||||
for i in nums:
|
||||
if i in temp:
|
||||
return i
|
||||
else:
|
||||
temp.append(i)
|
||||
Reference in New Issue
Block a user