Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or ...
分类:
其他好文 时间:
2020-07-14 21:56:23
阅读次数:
98
260 Single Number III Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. ...
分类:
其他好文 时间:
2020-07-14 21:54:31
阅读次数:
104
Array.prototype.myMap = function(callback){ const self = this; return self.reduce((prev,next,index)=>{ prev.push(callback(next,index,self)) return pre ...
分类:
其他好文 时间:
2020-07-14 21:47:46
阅读次数:
66
其实很久以前记过两者的用法,但是很快就忘记了,我发现确实学过的很多东西有时候会忘记。做个小小的记录。 Array.prototype.slice() slice: n.(切下的食物)薄片,片;部分;份额;锅铲;(餐桌用)小铲 v.把…切成(薄)片;切;割;划;削(球);斜切打 slice() 方法返 ...
分类:
编程语言 时间:
2020-07-14 18:00:10
阅读次数:
81
lua的下标默认从1开始,也可以指定数组索引值。 array = {}for i= -2, 2 do array[i] = i *2endfor i = -2,2 do print(array[i])end -4 -2 0 2 4多维数组以下是一个三行三列的阵列多维数组:-- 初始化数组array ...
分类:
编程语言 时间:
2020-07-14 16:16:46
阅读次数:
85
Given an unsorted array of integers, find the length of longest continuous increasing subsequence (subarray). 找最长连续上升子序列 class Solution(object): def f ...
分类:
其他好文 时间:
2020-07-14 00:26:48
阅读次数:
59
1. Array.forEach 循环 let arr = [1,2,3,4,5] arr.forEach(item=>{ console.log(item) }) 1 2 3 4 5 2.Array.map 遍历并生成新的数组 map方法不改变源数据,需要用变量接收,注意return的每一个值是新 ...
分类:
其他好文 时间:
2020-07-13 23:07:34
阅读次数:
92
np.concatenate((a, b), axis = 0) 按照axis结合两个矩阵,结合后的矩阵在axis的方向上增长 比如两个2×2的矩阵按照axis=0结合,输出矩阵为4×2 np.array.reshape(m, n) np.tile(a, n) 将矩阵a为单位复制成n的模样 n可以是... ...
分类:
其他好文 时间:
2020-07-13 21:49:13
阅读次数:
116
字符串和字节数组String str = "罗长"; byte[] sb = str.getBytes();//字符串转字节数组byte[] b={(byte)0xB8,(byte)0xDF,(byte)0xCB,(byte)0xD9}; String str= new String (b);//字 ...
分类:
其他好文 时间:
2020-07-13 21:48:59
阅读次数:
61
[C 语言实例 - 计算数组元素平均值 C 语言实例使用 for 循环迭代出输出元素,并将各个元素相加算出总和,再除于元素个数:实例 1#include int main() {int array[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 0}; int sum, loop... ...
分类:
编程语言 时间:
2020-07-13 21:47:05
阅读次数:
80