Tap here to switch tabs
Problem
Submissions

Problem: Longest Balanced Substring II

Try to solve the Longest Balanced Substring II problem.

Statement

Given a string s consisting only of the characters 'a', 'b', and 'c', return the length of the longest balanced substring in s.

A substring is considered balanced if all distinct characters that appear within it have the same frequency.

Constraints:

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

  • s contains only the characters 'a', 'b', and 'c'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Longest Balanced Substring II

Try to solve the Longest Balanced Substring II problem.

Statement

Given a string s consisting only of the characters 'a', 'b', and 'c', return the length of the longest balanced substring in s.

A substring is considered balanced if all distinct characters that appear within it have the same frequency.

Constraints:

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

  • s contains only the characters 'a', 'b', and 'c'.