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 3aac6fc commit e8ae68cCopy full SHA for e8ae68c
5_Basic_Recursion/intro.cpp
@@ -163,6 +163,34 @@ int fibonacciOfN(int n)
163
return fibonacciOfN(n - 1) + fibonacciOfN(n - 2);
164
}
165
166
+// Leetcode 125. Valid Palindrome
167
+bool isPalindrome(string s)
168
+{
169
+ int start = 0;
170
+ int end = s.size() - 1;
171
+ while (start <= end)
172
+ {
173
+ if (!isalnum(s[start]))
174
175
+ start++;
176
+ continue;
177
+ }
178
+ if (!isalnum(s[end]))
179
180
+ end--;
181
182
183
+ if (tolower(s[start]) != tolower(s[end]))
184
+ return false;
185
+ else
186
187
188
189
190
191
+ return true;
192
+}
193
+
194
int main()
195
{
196
int n;
0 commit comments