happy number leetcode

Solutions on MaxInterview for happy number leetcode by the best coders in the world

showing results for - "happy number leetcode"
Michelle
31 Apr 2020
1// Formula Math Happy Number
2
3let x1 = Math.pow(2, 2);
4let y1 = Math.pow(0, 2);
5let z1 = Math.pow(3, 2);
6
7console.log(`${x1} + ${y1} + ${z1} = ${x1+y1+z1}`);
8
9let x2 = Math.pow(1, 2);
10let y2 = Math.pow(3, 2);
11
12console.log(`${x2} + ${y2} = ${x2+y2}`);
13
14let x3 = Math.pow(1, 2);
15let x4 = Math.pow(0, 2);
16
17console.log(`${x3} + ${x4} = ${x3+x4}`);
18
19// output: 203 -> 13 -> 10 -> 1