what is the problem whith my code

import java.util.*;
class ccspetmber1 {
static int prefix(int i,int a[]){
int b=0;
for (int j=0;j<=i;j++)
{
b=b+a[j];
}

return b;

}
static int suffix(int n,int i,int a[]){
int b=0;

 for (int j=n-1;j>=i;j--)
 {
     
     b=b+a[j];
     
 }  

return b;}
public static void main(String aar[]){
Scanner s=new Scanner(System.in);
int T=s.nextInt();
while(T>=1){
int N=s.nextInt();
int a[]=new int[N];
int i=0,k=0,index=0;
int b[]=new int [N];

 for (int g=0;g<N;g++)
 {
     a[g]=s.nextInt();
 }
    for( i=0;i<N;i++)
        
     {       

b[i]=suffix(N,i,a)+prefix(i,a);

     } int min=b[0];
  for( k=1;k<N;k++){
      if (min>b[k])
          min=b[k];
      index=k;
  }     

System.out.println(index-1);
T–;}}}

this give the correct answer.but on submission it display wrong answer

You’re overthinking the question, your approach will give TLE. You can check out my solution

Or you can check out the editorial . If you still have any questions we will be happy to help!!

//