We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent a674237 commit 73b1341Copy full SHA for 73b1341
βvalid-palindrome/limlimjo.js
@@ -0,0 +1,23 @@
1
+/**
2
+ * @param {string} s
3
+ * @return {boolean}
4
+ */
5
+var isPalindrome = function(s) {
6
+ // 1. λ¬Έμμ΄μ λ€ μλ¬Έμλ‘ λ°κΎΈκ³ , μνλ²³/μ«μ μλ κ±° λ€ μ κ±°
7
+ if (s.length === 1) {
8
+ return true;
9
+ } else {
10
+ let lcLetter = s.toLowerCase().replace(/[^a-z0-9]/g, '');
11
+ //console.log(lcLetter);
12
+
13
+ // 2. λ¬Έμμ΄μ΄ μμμ μμν λμ λ€μμ μμν λ κ°μΌλ©΄ true, μλλ©΄ false
14
+ if(lcLetter) {
15
+ for(let i=0; i<Math.floor(lcLetter.length/2); i++) {
16
+ if (lcLetter[i] !== lcLetter[lcLetter.length - 1 - i]) return false;
17
+ }
18
19
20
21
22
23
+};
0 commit comments