Decimal to Binary String
Return the binary form of the non-negative integer n as a string of 0 and 1 characters, with no leading zeros (zero is "0"). Do not use bin or format.
Example 1
n 10
returns "1010"
"1010".
Example 2
n 0
returns "0"
"0".
Constraints
0 <= n <= 10**6
Write it in your browser, against the clock. The model solution, stepped through line by line, comes after.
More Math problems
- Digit Sum in Base KBeginner
- Digital RootBeginner
- Excel Sheet Column NumberBeginner
- Handshake CountBeginner
- Harshad NumberBeginner
- Hex String to DecimalBeginner
- Highest Power of TwoBeginner
- Is PrimeBeginner