6
This commit is contained in:
8
solutions/lc1507.py
Normal file
8
solutions/lc1507.py
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
class Solution:
|
||||||
|
def reformatDate(self, date: str) -> str:
|
||||||
|
month = ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
|
||||||
|
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"]
|
||||||
|
|
||||||
|
d = date.split(" ")
|
||||||
|
|
||||||
|
return f"{d[2]}-{month.index(d[1])+1:02}-{int(d[0][:-2]):02}"
|
||||||
17
solutions/lc1909.py
Normal file
17
solutions/lc1909.py
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
class Solution:
|
||||||
|
def canBeIncreasing(self, nums: List[int]) -> bool:
|
||||||
|
bad = 0
|
||||||
|
for i in range(1, len(nums)):
|
||||||
|
if nums[i] <= nums[i - 1]:
|
||||||
|
bad += 1
|
||||||
|
|
||||||
|
if bad > 1:
|
||||||
|
return False
|
||||||
|
|
||||||
|
l = i == 1 or nums[i] > nums[i - 2]
|
||||||
|
r = i == len(nums) - 1 or nums[i + 1] > nums[i - 1]
|
||||||
|
|
||||||
|
if not l and not r:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
7
solutions/lc3151.py
Normal file
7
solutions/lc3151.py
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
class Solution:
|
||||||
|
def isArraySpecial(self, nums: List[int]) -> bool:
|
||||||
|
for i in range(1, len(nums)):
|
||||||
|
if nums[i] % 2 == nums[i - 1] % 2:
|
||||||
|
return False
|
||||||
|
|
||||||
|
return True
|
||||||
3
solutions/lc557.py
Normal file
3
solutions/lc557.py
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
class Solution:
|
||||||
|
def reverseWords(self, s: str) -> str:
|
||||||
|
return " ".join(i[::-1] for i in s.split())
|
||||||
Reference in New Issue
Block a user