Push 163 file(s) from Obsidian
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
```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;
|
||||
}
|
||||
}
|
||||
```
|
||||
Reference in New Issue
Block a user