diff --git a/Week1/Valid Palindrome/week1_pooja b/Week1/Valid Palindrome/week1_pooja new file mode 100644 index 0000000..66541c2 --- /dev/null +++ b/Week1/Valid Palindrome/week1_pooja @@ -0,0 +1,21 @@ +class Solution { +public: + bool isPalindrome(string s) { + + int start = 0; + int end = s.size() - 1; + + while(start < end) + { + while( !isalnum(s[start]) && start < end) + start++; + while(!isalnum(s[end]) && start < end) + end--; + if( toupper(s[start]) != toupper(s[end]) && start < end ) + return false; + start++; + end--; + } + return true; + } +};