Skip to content

Commit

Permalink
leetcode existence of a sub in a str and its reverse
Browse files Browse the repository at this point in the history
  • Loading branch information
ferhatelmas committed Mar 22, 2024
1 parent 9b7d3ac commit bcd28a4
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
class Solution:
def isSubstringPresent(self, s: str) -> bool:
r, l = s[::-1], len(s)
return any(s[i : i + 2] in r for i in range(0, l - 1))

0 comments on commit bcd28a4

Please sign in to comment.