Help me understand time complexity of my solution


#1

public class Solution {
public String longestPalindrome(String A) {
int l = A.length();
int il = l; String ans = “”; boolean flag = false;
while(il>=1){
for(int i=0;i+il<=l;i++){
int st =i;
int end = i+il-1;
while(st<end && A.charAt(st) == A.charAt(end)){
st++;
end–;
}
if(st>=end){
flag=true;
ans = A.substring(i, i+il);
break;
}
}
if(flag==true)
break;
il–;
}
return ans;
}
}

Not sure if its exactly n^2 or not… It did get passed with no penalty.