diff --git a/package.json b/package.json index a38dd56..1426dbf 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "jest", "scripts": { "test": "jest", - "prepare": "husky install" + "prepare": "husky install", + "node": "node src/transpose/index.js" }, "keywords": [], "author": "", diff --git a/src/brackets/index.js b/src/brackets/index.js index 96b6766..43677fc 100644 --- a/src/brackets/index.js +++ b/src/brackets/index.js @@ -4,6 +4,28 @@ * @param {string} str The string of brackets. * @returns {"valid" | "invalid"} Whether or not the string is valid. */ -function isValid(str) {} +function isValid(str) { + let bracket = []; + let opening = '({['; + let closing = ')}]'; + let matching = { + ')': '(', + '}': '{', + ']': '[', + }; + +for(let i =0; i currSym) { + result += nextSym - currSym; + i++; + } else { + result += currSym; + } + } + return result; +} module.exports = romanToDecimal; diff --git a/src/transpose/index.js b/src/transpose/index.js index adec201..fb2842b 100644 --- a/src/transpose/index.js +++ b/src/transpose/index.js @@ -4,6 +4,8 @@ * @param {number[]} array The array to transpose * @returns {number[]} The transposed array */ -function transpose(array) {} +function transpose(array) { + return array[0].map((col, index) => array.map((row) => row[index])); +} module.exports = transpose;