File tree 2 files changed +21
-1
lines changed
August-LeetCoding-Challenge/03-Valid-Palindrome
2 files changed +21
-1
lines changed Original file line number Diff line number Diff line change
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
+ }
Original file line number Diff line number Diff line change 2
2
3
3
https://leetcode.com
4
4
5
-
6
5
## August LeetCoding Challenge
7
6
Click [ here] ( https://leetcode.com/explore/challenge/card/august-leetcoding-challenge/ ) for problem descriptions.
8
7
9
8
Solutions in various programming languages are provided. Enjoy it.
10
9
11
10
1 . [ Detect Capital] ( https://github.com/AlgoStudyGroup/Leetcode/tree/master/August-LeetCoding-Challenge/01-Detect-Capital )
12
11
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 )
13
13
14
14
## July LeetCoding Challenge
15
15
Click [ here] ( https://leetcode.com/explore/featured/card/july-leetcoding-challenge/ ) for problem descriptions.
You can’t perform that action at this time.
0 commit comments