Practice Substring With Largest Variance
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 variance of a string is defined as the largest difference between the number of occurrences of any 2 characters present in the string. Note the two characters may or may not be the same. Given a string s consisting of lowercase English letters only, return the largest variance possible among all substrings of s. A substring is a contiguous sequence of characters within a string.
Source: Substring With Largest Variance on LeetCode. Use the original task for its coding environment and submissions.
Examples
# Example 1
s = "aababbb"
3
# Example 2
s = "abcde"
0
Constraints
Related LeetCode Problems
Practice more problems similar to Substring With Largest Variance.
Review your practice with PhantomCodeAI
After trying the problem yourself, use the app to discuss your approach, complexity, and edge cases.