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.
2 parents 7bac230 + 3b96320 commit d444820Copy full SHA for d444820
βnumber-of-1-bits/hozzijeong.jsβ
@@ -0,0 +1,10 @@
1
+/**
2
+ * @param {number} n
3
+ * @return {number}
4
+ */
5
+var hammingWeight = function(n) {
6
+ const binary = n.toString(2);
7
+
8
9
+ return binary.replaceAll('0','').length
10
+};
βvalid-palindrome/hozzijeong.jsβ
@@ -0,0 +1,11 @@
+ * @param {string} s
+ * @return {boolean}
+var isPalindrome = function(s) {
+ const lowercase = s.toLowerCase(); // μλ¬Έμλ‘ λ³ν
+ const replacedString = lowercase.replaceAll(/[^a-z0-9]/g,''); // μ κ·ννμμ ν΅ν΄ μμ΄/μ«μκ° μλ κ°λ€μ ''λ‘ λ³ν
+ return replacedString === [...replacedString].reverse().join('') // κΈ°μ‘΄ λ¬Έμμ΄κ³Ό κ·Έ κ°μ λ€μ§μ λ¬Έμμ΄μ΄ κ°μμ§ λΉκ΅
11
0 commit comments