// For a balanced substring with one char, any length works (all chars are equal) maxlen = Math.max(maxlen, getLength(s, 'a')); // Consider 'b' and 'c' maxlen = Math ...
// Time Complexity: O(n²) (due to substring creation and window reset) } else if (right == s.length() - 1 && !(map.containsKey(s.substring(left, right + 1)))) { map ...