educative.io

Exception case for happy number code

this code can work with exceptional case where num equal to 2? to resolve this we need a set to remember sum’s

Hi @Akash_Pawar

Did you mean that the code gives a wrong answer for num=2? I just tested the code and it worked fine (i.e. it gave the correct result) for num=2.