摘要:
1/** 2 * @param {string[]} emails 3 * @return {number} 4 */ 5var numUniqueEmails = function(emails) { 6 const arr = emails.map(val => 7 (val.split('@' 阅读全文
摘要:
1/** 2 * @param {number[]} A 3 * @return {boolean} 4 */ 5var isMonotonic = function(A) { 6 return isDesc(A) || isAsce(A); 7}; 8 9var isDesc = function 阅读全文
摘要:
1// 整数 0、 1 和 2 分别表示红色、白色和蓝色 2/** 3 * @param {number[]} nums 4 * @return {void} Do not return anything, modify nums in-place instead. 5 */ 6var sortCo 阅读全文
摘要:
1/** 2 * @param {number[]} A 3 * @return {number[]} 4 */ 5// 6var sortArrayByParityII = function(A) { 7 let even = A.filter(value => value % 2 0); 8 l 阅读全文
摘要:
1// 905. 按奇偶排序数组 2/** 3 * @param {number[]} A 4 * @return {number[]} 5 */ 6var sortArrayByParity = function(A) { 7 return A.filter(value => value % 2 阅读全文
摘要:
1/** 2 * @param {number[]} nums 3 * @return {number[]} 4 */ 5var findDuplicates = function(nums) { 6 nums.sort((a,b) => a - b); 7 8 for (let i = 0; i 阅读全文
摘要:
1/** 2 * @param {string} S 3 * @param {string} T 4 * @return {string} 5 */ 6var customSortString = function(S, T) { 7 let r= ''; 8 for (let i = 0, l = 阅读全文
摘要:
1/** 2 * @param {string} S 3 * @return {string} 4 */ 5var reverseOnlyLetters = function(S) { 6 let reverseArr = [...S].filter(item => /[A-Za-z]/.test( 阅读全文
摘要:
1/** 2 * @param {string} s 3 * @param {string} t 4 * @return {string} 5 */ 6 7var findTheDifference = function(s, t) { 8 var t1 = t.split('').sort(); 阅读全文
摘要:
1/** 2 * Initialize your data structure here. 3 */ 4var MyHashMap = function() { 5 // 创建数组 6 let MyHashMap = []; 7}; 8 9/**10 * value will always be n 阅读全文
摘要:
1/** 2 * @param {number[]} nums 3 * @return {number} 4 */ 5 6var singleNumber = function(nums) { 7 const record = {}; 8 nums.forEach(value => { 9 reco 阅读全文
摘要:
1/** 2 * @param {string} s 3 * @return {string} 4 */ 5var frequencySort = function(s) { 6 const record = {}; 7 const sArr = [...s]; 8 sArr.forEach(val 阅读全文
摘要:
1/** 2 * @param {string[]} words 3 * @return {string[]} 4 */ 5var findWords = function(words) { 6 let rows = ['qwertyuiop', 'asdfghjkl', 'zxcvbnm']; 7 阅读全文
摘要:
1/**2 * @param {number[]} candies3 * @return {number}4 */5var distributeCandies = function(candies) {6 const types = new Set(candies).size;78 return M 阅读全文
摘要:
1var judgeCircle = function(moves) { 2 let x = 0, y = 0; 3 for (let i = 0, l = moves.length; i < l; i++) { 4 if(moves[i] 'U') { 5 y += 1; 6 } else if 阅读全文
摘要:
1/** 2 * @param {number[]} nums1 3 * @param {number} m 4 * @param {number[]} nums2 5 * @param {number} n 6 * @return {void} Do not return anything, mo 阅读全文