I need your help. This code, can't pass. Please tell me what is wrong. Thank you.

```
class Solution {
vector<int> frag(int n) {
vector<int> vi;
while (n > 0) {
vi.push_back(n % 10);
n /= 10;
}
return vi;
}
public:
bool isHappy(int n) {
vector<int> vi = frag(n);
int sum = 0;
static int count = 42;
while (count > 0) {
count --;
for (int i = 0; i < vi.size(); i++)
sum += vi[i] * vi[i];
if (sum == 1) return true;
return isHappy(sum);
}
return false;
}
};
```