FPEvalDataset/LeetCodeProblem
0304
1{2 "id": 2883,3 "name": "partition_string_into_minimum_beautiful_substrings",4 "difficulty": "Medium",5 "link": "https://leetcode.com/problems/partition-string-into-minimum-beautiful-substrings/",6 "date": "1687564800000",7 "task_description": "Given a binary string `s`, partition the string into one or more **substrings** such that each substring is **beautiful**. A string is **beautiful** if: It doesn't contain leading zeros. It's the **binary** representation of a number that is a power of `5`. Return _the **minimum** number of substrings in such partition. _If it is impossible to partition the string `s` into beautiful substrings, return `-1`. A **substring** is a contiguous sequence of characters in a string. **Example 1:** ``` **Input:** s = \"1011\" **Output:** 2 **Explanation:** We can paritition the given string into [\"101\", \"1\"]. - The string \"101\" does not contain leading zeros and is the binary representation of integer 51 = 5. - The string \"1\" does not contain leading zeros and is the binary representation of integer 50 = 1. It can be shown that 2 is the minimum number of beautiful substrings that s can be partitioned into. ``` **Example 2:** ``` **Input:** s = \"111\" **Output:** 3 **Explanation:** We can paritition the given string into [\"1\", \"1\", \"1\"]. - The string \"1\" does not contain leading zeros and is the binary representation of integer 50 = 1. It can be shown that 3 is the minimum number of beautiful substrings that s can be partitioned into. ``` **Example 3:** ``` **Input:** s = \"0\" **Output:** -1 **Explanation:** We can not partition the given string into beautiful substrings. ``` **Constraints:** `1 <= s.length <= 15` `s[i]` is either `'0'` or `'1'`.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "s = \"1011\"",12 "output": "2 "13 },14 {15 "label": "Example 2",16 "input": "s = \"111\"",17 "output": "3 "18 },19 {20 "label": "Example 3",21 "input": "s = \"0\"",22 "output": "-1 "23 }24 ],25 "private_test_cases": [26 {27 "input": "1001110001",28 "output": 129 },30 {31 "input": "101",32 "output": 133 },34 {35 "input": "011000111100100",36 "output": -137 },38 {39 "input": "1",40 "output": 141 },42 {43 "input": "100101",44 "output": -145 },46 {47 "input": "101",48 "output": 149 },50 {51 "input": "11111001",52 "output": 453 },54 {55 "input": "11111001",56 "output": 457 },58 {59 "input": "1001110001",60 "output": 161 },62 {63 "input": "101",64 "output": 165 }66 ],67 "haskell_template": "minimumBeautifulSubstrings :: String -> Int\nminimumBeautifulSubstrings s ",68 "ocaml_template": "let minimumBeautifulSubstrings (s: string) : int = ",69 "scala_template": "def minimumBeautifulSubstrings(s: String): Int = { \n \n}",70 "java_template": "public static int minimumBeautifulSubstrings(String s) {\n\n}",71 "python_template": "class Solution(object):\n def minimumBeautifulSubstrings(self, s):\n \"\"\"\n :type s: str\n :rtype: int\n \"\"\"\n "72}