My issue
I dont know what to do. Please help.
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();
String S = sc.next();
int value = Integer.parseInt(S, 2);
// System.out.println(value);
int max = 0, index = 0;
for(int i=1;i<=N;i++){
int X = value ^ (value/(1 << i));
// System.out.print(X+" ");
if (X > max){
max = X;
index = i;
}
}
System.out.println(index);
}
}
}
Problem Link: SINGLEOP1 Problem - CodeChef