Your Dashboard
Interview Coaching
Learn
System Design
ML System Design
Code
Behavioral
Salary Negotiation
Interview Guides
Search
⌘K
Get Premium
Leetcode 2712. Minimum Cost to Make All Characters Equal
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.
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Comments
Hello Interview Premium
Your account is free and you can post anonymously if you choose.