15 lines
320 B
Markdown
15 lines
320 B
Markdown
```java
|
|
public class PalindromeCheck {
|
|
public static boolean isPalindrome(String str) {
|
|
int left = 0, right = str.length() - 1;
|
|
|
|
while (left < right) {
|
|
if (str.charAt(left++) != str.charAt(right--)) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
return true;
|
|
}
|
|
}
|
|
``` |