my code is o(n) solution but still it says fails for larger test- cases . Someone please help

and tell whats wrong.

public int perfectPeak(ArrayList a) {

int min=a.get(0);

int i=1;

for(;i<a.size()-1;i++){

if(a.get(i)<min)continue;

min=a.get(i);

for(int j=i+1;j<a.size();j++){

if(a.get(i)<a.get(j)){

if(a.get(j)>min) min=a.get(j);

}

else{

i=j;

break;

}

if(j==a.size()-1) return 1;

}

}

return 0;

}