Skip to content

Commit ef50f1b

Browse files
authored
Merge pull request #244 from hellomrsun/master
Add Valid Palindrome C#
2 parents 867185f + e021e46 commit ef50f1b

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
public class Solution {
2+
public bool IsPalindrome(string s) {
3+
int begin = 0;
4+
int end = s.Length-1;
5+
while(begin <= end){
6+
while(begin<=end && !Char.IsLetterOrDigit(s[begin])){
7+
begin++;
8+
}
9+
while(begin<=end && !Char.IsLetterOrDigit(s[end])){
10+
end--;
11+
}
12+
if(begin<=end && Char.ToLower(s[begin]) != Char.ToLower(s[end])){
13+
return false;
14+
}
15+
begin++;
16+
end--;
17+
}
18+
return true;
19+
}
20+
}

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
https://leetcode.com
44

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

98
Solutions in various programming languages are provided. Enjoy it.
109

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

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

0 commit comments

Comments
 (0)