Write a number in binary
Standard · Write code · about 10 min
Return the binary form of n as a string, with no leading zeros. Zero is "0".
Example 1
Input:
[13]
Output:
1101
Example 2
Input:
[0]
Output:
0
Constraints
- 0 ≤ n ≤ 1,000,000,000
Learn the idea first: Bits, bytes and binary numbers, a visual lesson.
More Bits, bytes and binary numbers problems
- Count the 1 bits of a number Standard
- Add two binary strings Challenge