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 6a8eb40 commit e1de42eCopy full SHA for e1de42e
125.Valid Palindrome.cpp
@@ -0,0 +1,26 @@
1
+class Solution {
2
+public:
3
+ bool isPalindrome(string s) {
4
+ int left=0;
5
+ int right=s.length()-1;
6
+
7
+ while (left<right)
8
+ {
9
+ while(left<right && !isalnum(s[left]))
10
11
+ left++;
12
+ }
13
+ while (left < right && !isalnum(s[right]))
14
15
+ right --;
16
17
+ if (tolower(s[left]) != tolower(s[right]))
18
19
+ return false;
20
21
22
+ right--;
23
24
+ return true;
25
26
+};
0 commit comments