0
Q:

happy number leetcode

// Formula Math Happy Number

let x1 = Math.pow(2, 2);
let y1 = Math.pow(0, 2);
let z1 = Math.pow(3, 2);

console.log(`${x1} + ${y1} + ${z1} = ${x1+y1+z1}`);

let x2 = Math.pow(1, 2);
let y2 = Math.pow(3, 2);

console.log(`${x2} + ${y2} = ${x2+y2}`);

let x3 = Math.pow(1, 2);
let x4 = Math.pow(0, 2);

console.log(`${x3} + ${x4} = ${x3+x4}`);

// output: 203 -> 13 -> 10 -> 1
0

New to Communities?

Join the community