Solución
solution.tsTypeScript
export function maxDigit(n: number): number {
if (n === 0) return 0
let max = 0
while (n > 0) {
let digit = n % 10
if (digit > max) {
max = digit // update max
}
n = Math.floor(n / 10)
}
return max
}0respuestas