Tap here to switch tabs
Problem
Submissions

Problem: Minimum Changes to Make Binary String Beautiful

Try to solve the Minimum Number of Changes to Make Binary String Beautiful problem.

Statement

You are given a 00 indexed binary string s having an even length.

A binary string is considered beautiful if it can be partitioned into one or more disjoint substrings such that:

  • Each substring has an even length.

  • Each substring consists entirely of '$0$'s or entirely of '$1$'s.

You can change any character in s from '$0$' to '$1$' or from '$1$' to '$0$'.

Return the minimum number of changes needed to make s beautiful.

Constraints:

  • 2≤2 \leq s.length ≤105\leq 10^5

  • s has an even length.

  • s[i] is either '$0$' or '$1$'.

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Minimum Changes to Make Binary String Beautiful

Try to solve the Minimum Number of Changes to Make Binary String Beautiful problem.

Statement

You are given a 00 indexed binary string s having an even length.

A binary string is considered beautiful if it can be partitioned into one or more disjoint substrings such that:

  • Each substring has an even length.

  • Each substring consists entirely of '$0$'s or entirely of '$1$'s.

You can change any character in s from '$0$' to '$1$' or from '$1$' to '$0$'.

Return the minimum number of changes needed to make s beautiful.

Constraints:

  • 2≤2 \leq s.length ≤105\leq 10^5

  • s has an even length.

  • s[i] is either '$0$' or '$1$'.