NeetCode #785LC-2914MediumGreedy
← Back to All Problems#785 · #2914 · Minimum Number of Changes to Make Binary String Beautiful(使二进制字符串变美丽的最少修改次数)
📌 Problem Statement & Constraints
Given an even-length binary string
s, it is beautiful if it can be split into one or more even-length substrings, each with an equal number of 0s and 1s. Return the minimum number of character changes to make s beautiful. Constraints: 2 <= s.length <= 10^5, s.length is even, s consists of 0 and 1.🔒
Sign In to Unlock Full Solutions for All 973 Problems
Sign in to access step-by-step logic, benchmark Python3 code, complexity breakdown, and offline export!