Maximum Substrings

Problem Overview

  • Replace each '.' in the string with a lowercase letter to maximize the total number of beautiful substrings (all characters identical), and return that maximum.
  • Input: string color (length 1–5000) with '.' for white/unassigned; Output: integer count; substrings are contiguous.
  • Context: Parade uniforms in HackerLand where no white uniforms are allowed.
  • From Snowflake interviews; a coding interview problem and interview question focused on maximizing substrings.

Example

Unlock to view complete problem details

and practice with sample input/output

Was this article helpful?

View Test Cases & Run Code requires membership

Input Variables
Execution Result: