← Back to challenges

Binary Addition + 0 1 0 1

PythonMediumalgorithmsbit_operationsnumbers

Instructions

Create a function that takes two numbers and returns their sum as a binary string.

Examples

add_binary(1, 1) ➞ "10"

add_binary(1, 2) ➞ "11"

add_binary(4, 5) ➞ "1001"

Notes

  • Remember to return the converted result as a string.
python3
Loading editor…
to run
Walks through the solution with reasoning and edge cases.
Next: Maximum Weight Allowed