Tap here to switch tabs
Problem
Submissions

Problem: Unique Substrings in Wraparound String

Unique Substrings in Wraparound String gives you a string and an infinite alphabet string that loops from z back to a. Count its distinct nonempty substrings that occur in that wraparound string.

Statement

Consider an infinite wraparound string base formed by repeating the lowercase English alphabet indefinitely: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz...".

Given a string s, return the number of unique non empty substrings of s that also appear as substrings in base.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Unique Substrings in Wraparound String

Unique Substrings in Wraparound String gives you a string and an infinite alphabet string that loops from z back to a. Count its distinct nonempty substrings that occur in that wraparound string.

Statement

Consider an infinite wraparound string base formed by repeating the lowercase English alphabet indefinitely: "...zabcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz...".

Given a string s, return the number of unique non empty substrings of s that also appear as substrings in base.

Constraints:

  • 1≤1 \leq s.length ≤105\leq 10^5

  • s consists of lowercase English letters.