I cannot see why this cannot be accepted - C#

  • 0

    public class Solution {
    private static List<int> numbers = new List<int>();
    public bool IsHappy(int n) {

            return false;
        if(n == 1) return true;
        if(n == 0) return false;
        int newN = 0;
        int currentN = n;
        while(currentN > 0)
            newN = newN + currentN%10 *currentN%10;
            currentN  = currentN/10; 
        return IsHappy(newN);


    When I click submit, it fails and says if input is 7, it fails. But when I test with 7 in custom test, it passes. I am using C#. Is that possible there is a bug in the tester? Or anything incorrect in my code?

Log in to reply

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.