MCPcopy Create free account
hub / github.com/Ainevsia/Leetcode-Rust / next

Method next

Two Pointers/202. Happy Number/Solution.cpp:17–25  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15class Solution {
16public:
17 int next(int n) {
18 int sum = 0;
19 while (n != 0) {
20 int d = n % 10;
21 n /= 10;
22 sum += d * d;
23 }
24 return sum;
25 }
26
27 // two pointer
28 bool isHappy(int n) {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected