摘要: 给你一个含 n 个整数的数组 nums ,其中 nums[i] 在区间 [1, n] 内。请你找出所有在 [1, n] 范围内但没有出现在 nums 中的数字,并以数组的形式返回结果。 const findDisappearedNumbers = (nums = [1,1]) => { let le 阅读全文
posted @ 2023-02-03 16:24 671_MrSix 阅读(9) 评论(0) 推荐(0) 编辑
摘要: const thousandth = (num = 123456789, fixed = 0) => { const strNum = num.toFixed(fixed) const [startStr, endStr] = strNum.split('.') let endIdx = start 阅读全文
posted @ 2023-02-03 14:45 671_MrSix 阅读(149) 评论(0) 推荐(0) 编辑
摘要: const arrayReverseChangeMetaArray = (arr = [1,2,3]) => { const res = [] while(arr.length){ res.push(arr.pop()) } return res } const arrayReverse = (ar 阅读全文
posted @ 2023-02-03 14:21 671_MrSix 阅读(3) 评论(0) 推荐(0) 编辑
摘要: String.prototype.myTrim = function (){ return this.replace(/^\s+ | \s+$/g, '') } 阅读全文
posted @ 2023-02-03 14:15 671_MrSix 阅读(18) 评论(0) 推荐(0) 编辑
摘要: 如果使用函数怎么实现??? class ReduceNumber{ constructor(init = 0){ this.init = init } add(m){ this.init += m return this } minus(n){ this.init -= n return this 阅读全文
posted @ 2023-02-03 13:12 671_MrSix 阅读(15) 评论(0) 推荐(0) 编辑
摘要: /** * 给定一个无序数组,如[3,1,2,4,-7,4,5,-10,2],数组位置不能动,找出其中的两个数min和max,要求其差值是相对最大的。 * 要求:min所在的位置,必须在max所在的位置之前 * 举例:如果没有要求的话,min应该-10,max是5,但是由于-10所在的位置在5之后, 阅读全文
posted @ 2023-02-03 01:30 671_MrSix 阅读(31) 评论(0) 推荐(0) 编辑