8000 Update README.md · abroroo/leetcode@8a5f525 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8a5f525

Browse files
authored
Update README.md
1 parent 4d1ba18 commit 8a5f525

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,34 @@
33
List is periodically updated
44

55
## LeetCode
6+
### #125 Valid Palindrome
67

8+
```
9+
10+
var isPalindrome = function(s) {
11+
let i = 0;
12+
let j = s.length - 1;
13+
14+
while(i < j){
15+
let left = s[i].toLowerCase()
16+
let right = s[j].toLowerCase()
17+
18+
if (/\W|_/g.test(left)){
19+
i++;
20+
} else if (/\W|_/g.test(right)){
21+
j--;
22+
} else if (left == right){
23+
i++;
24+
j--;
25+
} else {
26+
return false
27+
}
28+
}
29+
return true
30+
};
31+
32+
33+
```
734
### #1 Two Sum
835

936
```

0 commit comments

Comments
 (0)
0