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.
2 parents bc71374 + cce794c commit 9f8a365Copy full SHA for 9f8a365
2018.11.27-leetcode125/halfofwater.md
@@ -0,0 +1,38 @@
1
+## leetcode 125
2
+
3
+```
4
+class Solution {
5
+public:
6
+ bool isPalindrome(string s) {
7
+ string::iterator it;
8
+ for (it = s.begin(); it != s.end(); it++)
9
+ {
10
+ //bool b1 = !(65 <= *it && *it <= 90);
11
+ //bool b2 = !(97 <= *it && *it <= 122);
12
+ //bool b3 = !(48 <= *it && *it <= 57);
13
14
+ if (!(65 <= *it && *it<= 90) && !(97 <= *it && *it <= 122) && !(48 <= *it && *it <= 57))
15
16
+ s.erase(it);
17
+ it--;
18
+ }
19
+ if (65 <= *it && *it <= 90)
20
21
+ *it += 32;
22
23
24
+ int len = s.size();
25
+ int i = 0, j = len - 1;
26
+ while (i < j)
27
28
+ if (s[i] != s[j])
29
30
+ return false;
31
32
+ i++;
33
+ j--;
34
35
+ return true;
36
37
+};
38
0 commit comments