From e98e90336ad6ee7438f75ba48aaf2d262e42518f Mon Sep 17 00:00:00 2001 From: doitchuu Date: Wed, 18 Mar 2026 18:09:19 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20Contains=20Duplicate=20=ED=92=80?= =?UTF-8?q?=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 --- doitchuu/ContainsDuplicate.js | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 doitchuu/ContainsDuplicate.js diff --git a/doitchuu/ContainsDuplicate.js b/doitchuu/ContainsDuplicate.js new file mode 100644 index 0000000..62dce10 --- /dev/null +++ b/doitchuu/ContainsDuplicate.js @@ -0,0 +1,10 @@ +/** + * @param {number[]} nums + * @return {boolean} + */ +var containsDuplicate = function(nums) { + const arrLength = nums.length; + const set = new Set(nums); + + return arrLength !== set.size; +}; From 255cf84fabdf1cdef605f19b93ce9dc91d5797f1 Mon Sep 17 00:00:00 2001 From: doitchuu Date: Wed, 18 Mar 2026 21:08:07 +0900 Subject: [PATCH 2/2] =?UTF-8?q?feat:=20Roman=20to=20Integer=20=ED=92=80?= =?UTF-8?q?=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 --- doitchuu/RomanToInteger.js | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 doitchuu/RomanToInteger.js diff --git a/doitchuu/RomanToInteger.js b/doitchuu/RomanToInteger.js new file mode 100644 index 0000000..a28e8f2 --- /dev/null +++ b/doitchuu/RomanToInteger.js @@ -0,0 +1,29 @@ +/** + * @param {string} s + * @return {number} + */ +var romanToInt = function(s) { + const romanMap = { + "I": 1, + "V": 5, + "X": 10, + "L": 50, + "C": 100, + "D": 500, + "M": 1000 + }; + let sum = 0; + + for (let i = 0; i < s.length - 1; i++) { + const current = romanMap[s[i]]; + const next = romanMap[s[i + 1]]; + + if (current < next) { + sum -= current; + } else { + sum += current; + } + } + + return sum += romanMap[s[s.length - 1]]; +};