From b8aa9ce7239963f2b6230be133bfde3a16fae4d0 Mon Sep 17 00:00:00 2001 From: jthw1005 Date: Tue, 30 Jun 2026 04:36:50 +0900 Subject: [PATCH 1/2] valid-anagram solution --- valid-anagram/jthw1005.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 valid-anagram/jthw1005.js diff --git a/valid-anagram/jthw1005.js b/valid-anagram/jthw1005.js new file mode 100644 index 0000000000..3ba2b4a480 --- /dev/null +++ b/valid-anagram/jthw1005.js @@ -0,0 +1,14 @@ +const isAnagram = (s, t) => { + const data = new Array(26).fill(0); + const a_ascii = 'a'.charCodeAt(); + + for (const char of s) { + data[char.charCodeAt() - a_ascii]++; + } + + for (const char of t) { + data[char.charCodeAt() - a_ascii]--; + } + + return !data.some((el) => el !== 0); +}; From 4c76ab83146f2501e9df87229a2a8afc4a36f95e Mon Sep 17 00:00:00 2001 From: jthw1005 Date: Thu, 2 Jul 2026 22:56:05 +0900 Subject: [PATCH 2/2] climbing-stairs solution --- climbing-stairs/jthw1005.js | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 climbing-stairs/jthw1005.js diff --git a/climbing-stairs/jthw1005.js b/climbing-stairs/jthw1005.js new file mode 100644 index 0000000000..c4df4152a4 --- /dev/null +++ b/climbing-stairs/jthw1005.js @@ -0,0 +1,13 @@ +function climbStairs(n) { + const memo = {}; + + function dp(k) { + if (k === 1) return 1; + if (k === 2) return 2; + if (memo[k]) return memo[k]; + memo[k] = dp(k - 1) + dp(k - 2); + return memo[k]; + } + + return dp(n); +}