摘要:
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 阅读全文