Removing Stars From a String

LeetCode題目: 2390. Removing Stars From a String My solution: /** * @param {string} s * @return {string} */ let removeStars = s => { let res = &#x2...

Memoize

LeetCode題目: 2623. Memoize My solution: /** * @param {Function} fn * @return {Function} */ function memoize(fn) { let map = new Map(); return fun...

Greatest Common Divisor of Strings

LeetCode題目: 1071. Greatest Common Divisor of Strings My solution: /** * @param {string} str1 * @param {string} str2 * @return {string} */ let gcdOfStri...

Equal Row and Column Pairs

LeetCode題目: 2352. Equal Row and Column Pairs My solution: /** * @param {number[][]} grid * @return {number} */ let equalPairs = grid => { let tot...

Determine if Two Strings Are Close

LeetCode題目: 1657. Determine if Two Strings Are Close My solution: /** * @param {string} word1 * @param {string} word2 * @return {boolean} */ let closeS...