Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update and rename week1.md to Divya #132

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions Week1/Valid Palindrome/Divya
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
class Solution {
public:
static bool isValid(char c){
if((c<='z'&&c>='a')||(c>='A'&&c<='Z')||(c>='0'&&c<='9')){
return true;
}
return false;
}
bool isPalindrome(string s) {
int start = 0;
int end = s.length()-1;

while(start<end){
if(!isValid(s[start])){
start++;
}else if(!isValid(s[end])){
end--;
}else if(tolower(s[start])!=tolower(s[end])){
return false;
}else if(tolower(s[start])==tolower(s[end])){
start++;
end--;
}

}

return true;
}
};

1 change: 0 additions & 1 deletion Week1/Valid Palindrome/week1.md

This file was deleted.