mirror of
https://git.wolves.top/wolves/leetcode.git
synced 2025-11-04 17:26:32 +08:00
14 lines
265 B
C
14 lines
265 B
C
#include <stdbool.h>
|
|
|
|
bool isPalindrome(char *s){
|
|
int len = strlen(s);
|
|
int left = 0, right = len - 1;
|
|
while (left < right) {
|
|
if (s[left] != s[right]) {
|
|
return false;
|
|
}
|
|
left++;
|
|
right--;
|
|
}
|
|
return true;
|
|
} |