Team Ai
Datasetpublic

FPEvalRepoPublic/LeetCodeMetaData

sourceHugging Faceupdated 9mo agoView on Hugging Face
0likes402downloads
maximum-odd-binary-number.json30 linesDownload Raw Back to root
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",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  "test_case": [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  "constraints": [21    "1 <= s.length <= 100",22    "s consists only of '0' and '1'.",23    "s contains at least one '1'."24  ],25  "python_template": "class Solution(object):\n    def maximumOddBinaryNumber(self, s):\n        \"\"\"\n        :type s: str\n        :rtype: str\n        \"\"\"\n        ",26  "java_template": "class Solution {\n    public String maximumOddBinaryNumber(String s) {\n        \n    }\n}",27  "metadata": {28    "func_name": "maximumOddBinaryNumber"29  }30}