Skip to content

Commit 0f8511b

Browse files
authored
Merge pull request #3159 from MITHUNTR7/main
Create 0459-repeated-substring-pattern.py
2 parents d24b83c + b01af14 commit 0f8511b

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
class Solution:
2+
def repeatedSubstringPattern(self, s: str) -> bool:
3+
return s in (s + s)[1:-1]
4+
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
class Solution:
2+
def maxProduct(self, nums: List[int]) -> int:
3+
high = secondHigh = 0
4+
for n in nums:
5+
if n > high:
6+
secondHigh = high
7+
high = n
8+
else:
9+
secondHigh = max(n, secondHigh)
10+
return (high - 1) * (secondHigh - 1)

0 commit comments

Comments
 (0)