上一页 1 2 3 4 5 6 7 8 9 10 ··· 36 下一页
摘要: 丑数 就是只包含质因数 2、3 和 5 的正整数。 给你一个整数 n ,请你判断 n 是否为 丑数 。如果是,返回 true ;否则,返回 false 。 /** * @param {number} n * @return {boolean} */ const isUgly = (n) => { i 阅读全文
posted @ 2023-02-04 15:15 671_MrSix 阅读(13) 评论(0) 推荐(0) 编辑
摘要: 编写一个高效的算法来判断 m x n 矩阵中,是否存在一个目标值。该矩阵具有如下特性: 每行中的整数从左到右按升序排列。每行的第一个整数大于前一行的最后一个整数。 /** * @param {number[][]} matrix * @param {number} target * @return 阅读全文
posted @ 2023-02-04 15:13 671_MrSix 阅读(12) 评论(0) 推荐(0) 编辑
摘要: 给你一个含 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) 编辑
摘要: class LazyMan { tasks = [] constructor(name){ this.name = name console.log(`I am ${name}`) setTimeout(() => { this.next() }) } next(){ const task = th 阅读全文
posted @ 2023-02-02 17:37 671_MrSix 阅读(6) 评论(0) 推荐(0) 编辑
摘要: const getValueType = (value) => { const originType = Object.prototype.toString.call(value) const spaceIndex = originType.indexOf(' ') return originTyp 阅读全文
posted @ 2023-02-02 13:10 671_MrSix 阅读(7) 评论(0) 推荐(0) 编辑
上一页 1 2 3 4 5 6 7 8 9 10 ··· 36 下一页