Skip to content

Commit 60aac55

Browse files
committed
Create README - LeetHub
1 parent b64da12 commit 60aac55

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<h2><a href="https://leetcode.com/problems/maximum-odd-binary-number/">2864. Maximum Odd Binary Number</a></h2><h3>Easy</h3><hr><div><p>You are given a <strong>binary</strong> string <code>s</code> that contains at least one <code>'1'</code>.</p>
2+
3+
<p>You have to <strong>rearrange</strong> the bits in such a way that the resulting binary number is the <strong>maximum odd binary number</strong> that can be created from this combination.</p>
4+
5+
<p>Return <em>a string representing the maximum odd binary number that can be created from the given combination.</em></p>
6+
7+
<p><strong>Note </strong>that the resulting string <strong>can</strong> have leading zeros.</p>
8+
9+
<p>&nbsp;</p>
10+
<p><strong class="example">Example 1:</strong></p>
11+
12+
<pre><strong>Input:</strong> s = "010"
13+
<strong>Output:</strong> "001"
14+
<strong>Explanation:</strong> Because there is just one '1', it must be in the last position. So the answer is "001".
15+
</pre>
16+
17+
<p><strong class="example">Example 2:</strong></p>
18+
19+
<pre><strong>Input:</strong> s = "0101"
20+
<strong>Output:</strong> "1001"
21+
<strong>Explanation: </strong>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".
22+
</pre>
23+
24+
<p>&nbsp;</p>
25+
<p><strong>Constraints:</strong></p>
26+
27+
<ul>
28+
<li><code>1 &lt;= s.length &lt;= 100</code></li>
29+
<li><code>s</code> consists only of <code>'0'</code> and <code>'1'</code>.</li>
30+
<li><code>s</code> contains at least one <code>'1'</code>.</li>
31+
</ul>
32+
</div>

0 commit comments

Comments
 (0)