Fair Candy Swap

LeetCode 題目: 888. Fair Candy Swap My solution: /** * @param {number[]} aliceSizes * @param {number[]} bobSizes * @return {number[]} */ let fairCandySwa...

Uncommon Words from Two Sentences

LeetCode 題目: 884. Uncommon Words from Two Sentences My solution: /** * @param {string} s1 * @param {string} s2 * @return {string[]} */ let uncommonFrom...

Binary Gap

LeetCode題目: 868. Binary Gap My solution: /** * @param {number} n * @return {number} */ let binaryGap = n => { let max = 0, indexArray = []; c...

Transpose Matrix

LeetCode題目: 867. Transpose Matrix My solution: /** * @param {number[][]} matrix * @return {number[][]} */ let transpose = matrix => { let m = mat...

Backspace String Compare

LeetCode題目: 844. Backspace String Compare My solution: /** * @param {string} s * @param {string} t * @return {boolean} */ let backspaceCompare = (s, t)...