Skip to content

Commit

Permalink
Update valid-palindrome.cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
kamyu104 committed Feb 21, 2016
1 parent 809a5b1 commit e63a6ee
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions C++/valid-palindrome.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ class Solution2 {
bool isPalindrome(string s) {
auto left = s.begin();
auto right = prev(s.end());
for(; left < right;) {
if(!isalnum(*left)) {
while (left < right) {
if (!isalnum(*left)) {
++left;
} else if(!isalnum(*right)) {
} else if (!isalnum(*right)) {
--right;
} else if(tolower(*left) != tolower(*right)) {
} else if (tolower(*left) != tolower(*right)) {
return false;
} else {
++left, --right;
Expand Down

0 comments on commit e63a6ee

Please sign in to comment.