Practice Total Appeal of A String
Read the task, work through the examples, and check your approach against the constraints. Use the original LeetCode task for coding and submissions.
Problem Statement
The appeal of a string is the number of distinct characters found in the string. Given a string s, return the total appeal of all of its substrings. A substring is a contiguous sequence of characters within a string.
Source: Total Appeal of A String on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
Input
s = "abbca"
Output
28
# Example 2
Input
s = "code"
Output
20
Constraints
1 <= s.length <= 10^5
s consists of lowercase English letters.
Related LeetCode Problems
Practice more problems similar to Total Appeal of A String.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.