Tap here to switch tabs
Problem
Submissions

Problem: Substring With Largest Variance

med
30 min
Try to solve the Substring With Largest Variance problem.

Statement

The variance of a string is defined as the largest difference between the frequencies of any 22 characters present in that string.

Given a string s consisting of lowercase English letters, return the maximum variance among all substrings of s.

A substring is a contiguous non empty sequence of characters within a string.

Constraints:

  • 1≤1 \leq s.length ≤104\leq 10^4

  • s consists of lowercase English letters.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Substring With Largest Variance

med
30 min
Try to solve the Substring With Largest Variance problem.

Statement

The variance of a string is defined as the largest difference between the frequencies of any 22 characters present in that string.

Given a string s consisting of lowercase English letters, return the maximum variance among all substrings of s.

A substring is a contiguous non empty sequence of characters within a string.

Constraints:

  • 1≤1 \leq s.length ≤104\leq 10^4

  • s consists of lowercase English letters.