Skip to content

Add Valid Palindrome C# #244

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

Merged
merged 2 commits into from
Aug 3, 2020
Merged
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class Solution {
public bool IsPalindrome(string s) {
int begin = 0;
int end = s.Length-1;
while(begin <= end){
while(begin<=end && !Char.IsLetterOrDigit(s[begin])){
begin++;
}
while(begin<=end && !Char.IsLetterOrDigit(s[end])){
end--;
}
if(begin<=end && Char.ToLower(s[begin]) != Char.ToLower(s[end])){
return false;
}
begin++;
end--;
}
return true;
}
}
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@

https://leetcode.com


## August LeetCoding Challenge
Click [here](https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/) for problem descriptions.

Solutions in various programming languages are provided. Enjoy it.

1. [Detect Capital](https://github.com/AlgoStudyGroup/Leetcode/tree/master/August-LeetCoding-Challenge/01-Detect-Capital)
2. [Design HashSet](https://github.com/AlgoStudyGroup/Leetcode/tree/master/August-LeetCoding-Challenge/02-Design-HashSet)
3. [Valid Palindrome](https://github.com/AlgoStudyGroup/Leetcode/tree/master/August-LeetCoding-Challenge/03-Valid-Palindrome)

## July LeetCoding Challenge
Click [here](https://leetcode.com/explore/featured/card/july-leetcoding-challenge/) for problem descriptions.
Expand Down