Available question text
Given a binary string s (n ≤ 1e5), you may flip any prefix ending at i (cost i+1) or any suffix starting at i (cost n−i); compute the minimum total cost to make all characters identical. The challenge is to choose prefix/suffix flips—which toggle runs and can cancel each other—optimally to remove transitions and reach all 0s or all 1s.
Related questions
Continue with questions that share topics or the same question type.
Sources · 1 reference
These records explain where the question appears. A company tag or candidate report does not guarantee a future interview question.
Hello Interview · 1 record
No company association
Leetcode 2712. Minimum Cost to Make All Characters Equal
Reported date not specified · 0 source reports
Source snapshot: Nov 12, 2026
View source