Count triplets (i, j, k) that split a string into two magical string pairs.
Unlock detailed company stats for this questionUpgrade
Two non-empty strings s1 and s2 are magical string pairs if the set of distinct characters in s1 equals that of s2. Given a string s of strictly lowercase letters, find the number of triplets (i, j, k) where i <= j < k, such that the substrings s1 = s[i:j+1] and s2 = s[j+1:k+1] are magical string pairs.
Community answers
No answers contributed by the community yet.
Related questions
Count the ways to split a digit string into prime numbers.Related courses

Course

Course
Course
