前言 一位正在学习前端的菜鸟,虽菜,但还未放弃. 给大家画张图了解思路 以下是代码 function randomArr(arr,num){ let newArr = [];//创建一个新数组 for (let i = 0; i < 30; i++) { let temp = Math.floor(Math.random()*arr.length);//取随机下标 newArr.push(arr[temp]);//添加到新数组 arr.splice(temp,1)//删除当前的数组元素,避免重复…
引自:http://bbs.tianya.cn/post-414-38497-1.shtml 方法一: var ary = new Array("111","22","33","111"); var s = ary.join(",")+","; for(var i=0;i<ary.length;i++) { if(s.replace(ary[i]+",",&qu…
题目: Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B are m and n respectively. 题意要把两个有序的数组合并到他们…