TheRealSamuel/LeetCodeProblem
0561
1{2 "id": 3055,3 "name": "maximum_odd_binary_number",4 "difficulty": "Easy",5 "link": "https://leetcode.com/problems/maximum-odd-binary-number/",6 "date": "2023-09-17 00:00:00",7 "task_description": "You are given a **binary** string `s` that contains at least one `'1'`. You have to **rearrange** the bits in such a way that the resulting binary number is the **maximum odd binary number** that can be created from this combination. Return _a string representing the maximum odd binary number that can be created from the given combination._ **Note **that the resulting string **can** have leading zeros. **Example 1:** ``` **Input:** s = \"010\" **Output:** \"001\" **Explanation:** Because there is just one '1', it must be in the last position. So the answer is \"001\". ``` **Example 2:** ``` **Input:** s = \"0101\" **Output:** \"1001\" **Explanation: **One of the '1's must be in the last position. The maximum number that can be made with the remaining digits is \"100\". So the answer is \"1001\". ``` **Constraints:** `1 <= s.length <= 100` `s` consists only of `'0'` and `'1'`. `s` contains at least one `'1'`.",8 "public_test_cases": [9 {10 "label": "Example 1",11 "input": "s = \"010\"",12 "output": "\"001\" "13 },14 {15 "label": "Example 2",16 "input": "s = \"0101\"",17 "output": "\"1001\" "18 }19 ],20 "private_test_cases": [21 {22 "input": "100110100001001110100010000011110000001011010001110100100110000010100011110011000111010",23 "output": "111111111111111111111111111111111111000000000000000000000000000000000000000000000000001"24 },25 {26 "input": "0000000001100111000000111010101110111111011101010010100001101100010001111000101100100000111001",27 "output": "1111111111111111111111111111111111111111110000000000000000000000000000000000000000000000000001"28 },29 {30 "input": "001110000001101101100011010011110011001011101110010001000111011010110011001",31 "output": "111111111111111111111111111111111111100000000000000000000000000000000000001"32 },33 {34 "input": "0011010100000101010100000011101000101010000100101110101100011111010000101110110100",35 "output": "1111111111111111111111111111111111100000000000000000000000000000000000000000000001"36 },37 {38 "input": "10111100110111000111000001111100",39 "output": "11111111111111111000000000000001"40 },41 {42 "input": "101110000001000001011111101000100010010001101011101100011101100",43 "output": "111111111111111111111111111100000000000000000000000000000000001"44 },45 {46 "input": "11101111000110011100110101101011101100101000011000001111111100000011100001",47 "output": "11111111111111111111111111111111111111000000000000000000000000000000000001"48 },49 {50 "input": "01010100101010110010000011101111010001001110010100000111001110110",51 "output": "11111111111111111111111111111100000000000000000000000000000000001"52 },53 {54 "input": "011111110",55 "output": "111111001"56 },57 {58 "input": "111011010110101001010100001111100010101100000100110011001",59 "output": "111111111111111111111111111000000000000000000000000000001"60 }61 ],62 "haskell_template": "maximumOddBinaryNumber :: String -> String\nmaximumOddBinaryNumber s ",63 "ocaml_template": "let maximumOddBinaryNumber (s: string) : string = ",64 "scala_template": "def maximumOddBinaryNumber(s: String): String = { \n \n}",65 "java_template": "class Solution {\n public String maximumOddBinaryNumber(String s) {\n \n }\n}",66 "python_template": "class Solution(object):\n def maximumOddBinaryNumber(self, s):\n \"\"\"\n :type s: str\n :rtype: str\n \"\"\"\n "67}