Solución
solution.tsTypeScript
export function numberOfSteps(n: number): number {
// Escribe tu solución aquí
let currentValue = n;
let count = 0;
while(currentValue > 0){
const isPar = (Math.floor(currentValue/2) - currentValue/2) === 0;
if(isPar){
currentValue = currentValue/2
}else{
currentValue = currentValue-1
}
count++
}
return count;
}0respuestas