Decimal to Binary Using Stack

Published by BijogFc24 in

Create a function that takes a decimal number and converts it to a binary number using Stack. The Stack is created for you.

Examples

toBinary(12) ➞ 1100

toBinary(0) ➞ 0

toBinary(101) ➞ 1100101

Notes

0 <= n <= 101

Watch a quick demo on how Edabit works.