I solve the 2nd problem and in test cases it work fine but as I submited it throw
Last executed input: 209701322
error I don't understand what to do with this
here is my code
`public boolean isHappy(int positiveNumber) {
// repeat the process until the number equals 1
for(int i = positiveNumber; i !=1; i--) {
// tracking of those numbers which are replace the number by the sum of the squares of its digits
int replaceBySumOfSquare = 0;
// split the number and do the square of it
while(positiveNumber > 0) {
replaceBySumOfSquare += Math.pow(positiveNumber % 10, 2);
positiveNumber = positiveNumber/10;
}
// again update the number for checking weather it true or false
positiveNumber = replaceBySumOfSquare;
}
if(positiveNumber == 1)
return true;
else
return false;
}
}can anybody help me how to deal with this problem.