File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -90,19 +90,19 @@ public String longestPalindrome(String s) {
9090
9191 var isPalindrome = new boolean [len ][len ];
9292
93- for (int i = len -1 ; i >= 0 ; i --) {
94- for (int j = i ; j < len ; j ++) {
95- if (i == j ) {
93+ for (int i = len -1 ; i >= 0 ; i --) {
94+ for (int j = i ; j < len ; j ++) {
95+ if (i == j ) {
9696 isPalindrome [i ][j ] = true ;
97- } else if (s .charAt (i ) == s .charAt (j )) {
98- if (j - i == 1 ) {
97+ } else if (s .charAt (i ) == s .charAt (j )) {
98+ if (j - i == 1 ) {
9999 isPalindrome [i ][j ] = true ;
100100 } else {
101101 isPalindrome [i ][j ] = isPalindrome [i +1 ][j -1 ];
102102 }
103103 }
104104
105- if (isPalindrome [i ][j ] && j -i +1 > max ) {
105+ if (isPalindrome [i ][j ] && j -i +1 > max ) {
106106 max = j -i +1 ;
107107 left = i ;
108108 right = j +1 ;
You can’t perform that action at this time.
0 commit comments