Could someone help me with the logic of PEPPERON ?
my code is:
import java.io.*;
class PEPPERON
{
public static void main(String[] args)throws IOException
{
BufferedReader br=new BufferedReader(new InputStreamReader(System.in));
int T=Integer.parseInt(br.readLine());
int N,a[],j,i,k,min,co[][],x,y,c,d,p1,p2;
String s;
for(i=1;i<=T;i++)
{
p1=0;
p2=0;
N=Integer.parseInt(br.readLine());
//a=new int[M][N];
co=new int[N][2];
for(j=0;j<N;j++)
{
x=y=0;
s=br.readLine();
for(k=0;k<N;k++)
{
int z=s.charAt(k)-48;
if(z==1&&k<N/2)
{
x++;
p1++;
}
else if(z==1&&k>=N/2)
{
y++;
p2++;
}
co[k][0]=x;
co[k][1]=y;
}
}
min=(int)(Math.abs(p1-p2));
for(j=0;j<N;j++)
{
c=p1-co[j][0]+co[j][1];
d=p2-co[j][1]+co[j][0];
int e=(int)(Math.abs(c-d));
if(e<min)
min=e;
}
System.out.println(min);
}
}
}