My issue
Why is it not working if we take int instead of string
My code
/* package codechef; // don't place package name! */
import java.util.*;
import java.lang.*;
import java.io.*;
/* Name of the class has to be "Main" only if the class is public. */
class Codechef
{
public static void main (String[] args) throws java.lang.Exception
{
Scanner sc = new Scanner(System.in);
int T = sc.nextInt();
while(T>0){
int n = sc.nextInt();
int count0 =0;
int count1 =0;
int count =0;
while(n >0){
int temp = n%10;
System.out.println(temp);
if(temp == 0)
count0++;
else
count1++;
n = n/10;
count++;
System.out.println("n : "+n);
System.out.println("count : " + count);
}
if(count1 == 1 || count0 == 1)
System.out.println("YES");
else
System.out.println("NO");
T--;
}
}
}
Problem Link: LONGSEQ Problem - CodeChef