Class Solution
-
- All Implemented Interfaces:
public final class Solution467 - Unique Substrings in Wraparound String.
Medium
We define the string
baseto be the infinite wraparound string of"abcdefghijklmnopqrstuvwxyz", sobasewill look like this:"...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyzabcd....".
Given a string
s, return the number of unique non-empty substrings ofsare present inbase.Example 1:
Input: s = "a"
Output: 1
Explanation: Only the substring "a" of s is in base.
Example 2:
Input: s = "cac"
Output: 2
Explanation: There are two substrings ("a", "c") of s in base.
Example 3:
Input: s = "zab"
Output: 6
Explanation: There are six substrings ("z", "a", "b", "za", "ab", and "zab") of s in base.
Constraints:
<code>1 <= s.length <= 10<sup>5</sup></code>
sconsists of lowercase English letters.
-
-
Constructor Summary
Constructors Constructor Description Solution()
-
Method Summary
Modifier and Type Method Description final IntegerfindSubstringInWraproundString(String p)-
-
Method Detail
-
findSubstringInWraproundString
final Integer findSubstringInWraproundString(String p)
-
-
-
-