lemon031
lemon031
全部文章
题解
归档
标签
去牛客网
登录
/
注册
lemon031的博客
全部文章
/ 题解
(共6篇)
题解 | #快速排序#
const _quickSort = array => { // 补全代码 if(Array.isArray(array) && array.length <= 1) return array let left = [] let right = [] ...
HTML/CSS/JavaScript
2022-04-20
0
415
题解 | #属性遍历#
function iterate(obj) { const ary = [] Object.keys(obj).forEach(item => { ary.push(`${item}: ${obj[item]}`) }) return ary }
HTML/CSS/JavaScript
2021-10-09
0
313
题解 | #二进制转换#
function convertToBinary(num) { const n = num.toString(2) return n.length < 8 ? new Array(8-n.length).fill(0).join('') + n : n }
HTML/CSS/JavaScript
2021-10-08
0
398
题解 | #乘法#
function multiply(a, b) { function getl(num) { const l = num.toString().indexOf('.') return l == -1 ? 0 : num.toString().length - l - 1 } ...
HTML/CSS/JavaScript
2021-10-08
5
399
题解 | #查找元素位置#
function findAllOccurrences(arr, target) { let a = [] arr.forEach((item, index) => { if(item == target) a.push(index) }) return a }
HTML/CSS/JavaScript
2021-09-16
0
395
题解 | #查找重复元素#
function duplicates(arr) { return arr.filter((item, index) => { return arr.indexOf(item) != arr.lastIndexOf(item) && arr.indexOf(item...
Javascript Node
HTML/CSS/JavaScript
数组
2021-09-16
1
368