We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 10a0de1 commit 4d0a9e9Copy full SHA for 4d0a9e9
valid palindrome
@@ -0,0 +1,15 @@
1
+#include <ctype.h>
2
+#include <stdbool.h>
3
+#include <string.h>
4
+
5
+bool isPalindrome(char * s) {
6
+ int left = 0, right = strlen(s) - 1;
7
+ while (left < right) {
8
+ while (left < right && !isalnum(s[left])) left++;
9
+ while (left < right && !isalnum(s[right])) right--;
10
+ if (tolower(s[left]) != tolower(s[right])) return false;
11
+ left++;
12
+ right--;
13
+ }
14
+ return true;
15
+}
0 commit comments