MCPcopy Create free account
hub / github.com/neetcode-gh/leetcode / sumOfSquare

Method sumOfSquare

java/0202-happy-number.java:22–33  ·  view source on GitHub ↗
(int n)

Source from the content-addressed store, hash-verified

20 }
21
22 public int sumOfSquare(int n) {
23 int output = 0;
24
25 while (n != 0) {
26 int digit = n % 10;
27 digit = digit * digit;
28 output += digit;
29 n = n / 10;
30 }
31
32 return output;
33 }
34}

Callers 1

isHappyMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected