From c228f28476d5761c23e77b21a8a2d6e7ba6daadb Mon Sep 17 00:00:00 2001 From: sik9252 Date: Thu, 2 Apr 2026 22:10:31 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20Palindrome=20Linked=20List=20?= =?UTF-8?q?=ED=92=80=EC=9D=B4=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sik9252/PalindromeLinkedList.js | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 sik9252/PalindromeLinkedList.js diff --git a/sik9252/PalindromeLinkedList.js b/sik9252/PalindromeLinkedList.js new file mode 100644 index 0000000..3085b6f --- /dev/null +++ b/sik9252/PalindromeLinkedList.js @@ -0,0 +1,19 @@ +var isPalindrome = function (head) { + const arr = []; + + while (head) { + arr.push(head.val); + head = head.next; + } + + let left = 0; + let right = arr.length - 1; + + while (left < right) { + if (arr[left] !== arr[right]) return false; + left++; + right--; + } + + return true; +}; From 9e11c39e94f2e380a3a1d8b415c22d4f05e4e534 Mon Sep 17 00:00:00 2001 From: sik9252 Date: Thu, 2 Apr 2026 22:10:49 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20Move=20Zeroes=20=ED=92=80=EC=9D=B4?= =?UTF-8?q?=20=EC=9E=91=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sik9252/MoveZeroes.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 sik9252/MoveZeroes.js diff --git a/sik9252/MoveZeroes.js b/sik9252/MoveZeroes.js new file mode 100644 index 0000000..0d1091e --- /dev/null +++ b/sik9252/MoveZeroes.js @@ -0,0 +1,15 @@ +var moveZeroes = function (nums) { + let idx = 0; + + for (let i = 0; i < nums.length; i++) { + if (nums[i] !== 0) { + nums[idx] = nums[i]; + idx++; + } + } + + while (idx < nums.length) { + nums[idx] = 0; + idx++; + } +};