• + 2 comments
    static boolean isStrange(long x){
            long length = String.valueOf(x).length();
            if (length == 1)    
                    return true;
            if ((x%length == 0) && isStrange(x/length))    
                    return true;
            return false;
    }
    
    static int solve(long l, long r) {
            int count = 0;
            for (long i = l; i<=r; i++) 
                    if (isStrange(i))   
                            count++;
            return count;
    }