Class Solution
-
- All Implemented Interfaces:
public final class Solution3083 - Existence of a Substring in a String and Its Reverse.
Easy
Given a string
s, find any substring of length2which is also present in the reverse ofs.Return
trueif such a substring exists, andfalseotherwise.Example 1:
Input: s = "leetcode"
Output: true
Explanation: Substring
"ee"is of length2which is also present inreverse(s) == "edocteel".Example 2:
Input: s = "abcba"
Output: true
Explanation: All of the substrings of length
2"ab","bc","cb","ba"are also present inreverse(s) == "abcba".Example 3:
Input: s = "abcd"
Output: false
Explanation: There is no substring of length
2ins, which is also present in the reverse ofs.Constraints:
1 <= s.length <= 100sconsists only of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final BooleanisSubstringPresent(String s)-
-
Method Detail
-
isSubstringPresent
final Boolean isSubstringPresent(String s)
-
-
-
-