1
This commit is contained in:
5
solutions/lc1725.py
Normal file
5
solutions/lc1725.py
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class Solution:
|
||||||
|
def countGoodRectangles(self, rectangles: List[List[int]]) -> int:
|
||||||
|
sqrs = [min(i) for i in rectangles]
|
||||||
|
|
||||||
|
return sqrs.count(max(sqrs))
|
||||||
14
solutions/lc1748.py
Normal file
14
solutions/lc1748.py
Normal file
@@ -0,0 +1,14 @@
|
|||||||
|
class Solution:
|
||||||
|
def sumOfUnique(self, nums: List[int]) -> int:
|
||||||
|
set_nums = set()
|
||||||
|
set_second = set()
|
||||||
|
|
||||||
|
for i in nums:
|
||||||
|
if i in set_nums:
|
||||||
|
set_nums.remove(i)
|
||||||
|
set_second.add(i)
|
||||||
|
else:
|
||||||
|
if i not in set_second:
|
||||||
|
set_nums.add(i)
|
||||||
|
|
||||||
|
return sum(set_nums)
|
||||||
16
solutions/lc1768.py
Normal file
16
solutions/lc1768.py
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
class Solution:
|
||||||
|
def mergeAlternately(self, word1: str, word2: str) -> str:
|
||||||
|
word3 = ""
|
||||||
|
j = i = 0
|
||||||
|
len1 = len(word1)
|
||||||
|
len2 = len(word2)
|
||||||
|
while j < len1 or i < len2:
|
||||||
|
if j < len1:
|
||||||
|
word3 += "".join(word1[j])
|
||||||
|
j += 1
|
||||||
|
|
||||||
|
if i < len2:
|
||||||
|
word3 += "".join(word2[i])
|
||||||
|
i += 1
|
||||||
|
|
||||||
|
return word3
|
||||||
8
solutions/lc1967.py
Normal file
8
solutions/lc1967.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Solution:
|
||||||
|
def numOfStrings(self, patterns: List[str], word: str) -> int:
|
||||||
|
r = 0
|
||||||
|
for i in patterns:
|
||||||
|
if i in word:
|
||||||
|
r += 1
|
||||||
|
|
||||||
|
return r
|
||||||
8
solutions/lc2678.py
Normal file
8
solutions/lc2678.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Solution:
|
||||||
|
def countSeniors(self, details: List[str]) -> int:
|
||||||
|
total = 0
|
||||||
|
for i in details:
|
||||||
|
if int(i[11:13]) > 60:
|
||||||
|
total += 1
|
||||||
|
|
||||||
|
return total
|
||||||
9
solutions/lc2960.py
Normal file
9
solutions/lc2960.py
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
class Solution:
|
||||||
|
def countTestedDevices(self, batteryPercentages: List[int]) -> int:
|
||||||
|
total = 0
|
||||||
|
|
||||||
|
for i in batteryPercentages:
|
||||||
|
if i-total > 0:
|
||||||
|
total += 1
|
||||||
|
|
||||||
|
return total
|
||||||
Reference in New Issue
Block a user