Tap here to switch tabs
Problem
Submissions

Problem: Partition String Into Minimum Beautiful Substrings

med
30 min
Try to solve the Partition String Into Minimum Beautiful Substrings problem.

Statement

Given a binary string s, partition it into the minimum number of beautiful substrings.

A substring is considered beautiful if:

  • It does not contain any leading zeros.

  • It is the binary representation of a power of 55 (such that the value equals 5k5^k for some integer k≥0k \geq 0).

Return the minimum number of beautiful substrings into which s can be partitioned. If it is impossible to partition s this way, return −1-1.

Constraints:

  • 1≤1 \leq s.length ≤15\leq 15

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

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Partition String Into Minimum Beautiful Substrings

med
30 min
Try to solve the Partition String Into Minimum Beautiful Substrings problem.

Statement

Given a binary string s, partition it into the minimum number of beautiful substrings.

A substring is considered beautiful if:

  • It does not contain any leading zeros.

  • It is the binary representation of a power of 55 (such that the value equals 5k5^k for some integer k≥0k \geq 0).

Return the minimum number of beautiful substrings into which s can be partitioned. If it is impossible to partition s this way, return −1-1.

Constraints:

  • 1≤1 \leq s.length ≤15\leq 15

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