```
#include <uthash.h>
```

typedef struct my_hlist

{

int n;

UT_hash_handle hh;

}hlist;

hlist *list = NULL;

hlist *node;

bool isHappy(int n) {

int sum=0;

while (1)

{

sum = 0;

while (n)

{

sum += (n%10)*(n%10);

n= n/10;

}

n = sum;

if(sum == 1)

return true;

```
node = NULL;
HASH_FIND_INT(list,&sum,node);
if(node)
return false;
node = malloc(sizeof(hlist));
node->n = sum;
HASH_ADD_INT(list,n,node);
}
```

}