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...

Unique Number of Occurrences

LeetCode題目: 1207. Unique Number of Occurrences My solution: /** * @param {number[]} arr * @return {boolean} */ let uniqueOccurrences = arr => { l...

Allow One Function Call

LeetCode題目: 2666. Allow One Function Call My solution: /** * @param {Function} fn * @return {Function} */ let once = fn => { function* gen() { ...