bits of zeros and ones that contains at least one 1. Rearrange its characters to form the largest binary number that is odd.
Return the resulting string. Its length stays the same, and leading zeros are allowed.bits="0110" → '1001'
One 1 must go last, or the number is even. The remaining 1, 0, 0 give the largest prefix 100, so the answer is 1001.
bits="100" → '001'
There is only one 1, and it moves to the end: 001. Leading zeros are fine.
bits="11" → '11'
bits consists of the characters 0 and 1bits contains at least one 1bits="0110"
'1001'
Run checks the first 3 tests in your browser. Submit checks all 81 tests on the server, hidden ones included.