Solución
solution.tsTypeScript
export function convertToBinary(n: number): string {
let res: number = 0;
let position: number = 0;
while (n > 0) {
const mod: number = n%2;
res = mod*10**position + res;
position++;
n = Math.floor(n/2);
}
return res.toString();
}0respuestas