https://leetcode.com/problems/existence-of-a-substring-in-a-string-and-its-reverse/description/
1 2 3 4 5 6 7 8 | class Solution: def isSubstringPresent(self, s: str) -> bool: reverse_s = s[::-1] for i in range(1, len(s)): if reverse_s[i-1:i+1] in s: return True return False | cs |
반응형
'python-algorithm' 카테고리의 다른 글
leetcode 3069. Distribute Elements Into Two Arrays I (0) | 2024.04.24 |
---|---|
leetcode 3079. Find the Sum of Encrypted Integers (0) | 2024.04.24 |
leetcode 3099. Harshad Number (0) | 2024.04.23 |
leetcode 3046. Split the Array (0) | 2024.04.22 |
leetcode 3110. Score of a String (0) | 2024.04.22 |
댓글