码迷,mamicode.com
首页 >  
搜索关键字:stl array    ( 35607个结果)
[STL] vector中函数emplace_back的实现原理
在vector中的emplace_back函数, 其效率比push_back高很多! /*例子中使用的Student类的声明*/ class Student { private: int age; public: Student(); explicit Student(int age); ~Stud ...
分类:其他好文   时间:2020-07-15 01:00:17    阅读次数:145
532. K-diff Pairs in an Array
Given an array of integers and an integer k, you need to find the number of unique k-diff pairs in the array. Here a k-diff pair is defined as an inte ...
分类:其他好文   时间:2020-07-15 01:00:03    阅读次数:73
35. Search Insert Position
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
leetcode260 Single Number III
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
利用reduce 模仿map原理
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
数组常用slice和splice的区别
其实很久以前记过两者的用法,但是很快就忘记了,我发现确实学过的很多东西有时候会忘记。做个小小的记录。 Array.prototype.slice() slice: n.(切下的食物)薄片,片;部分;份额;锅铲;(餐桌用)小铲 v.把…切成(薄)片;切;割;划;削(球);斜切打 slice() 方法返 ...
分类:编程语言   时间:2020-07-14 18:00:10    阅读次数:81
lua 数组
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
快速排序实现(快排)
/* 先来看下快排 9.9 快速排序 事实上,不论是C++ STL、java SDK或者.NETFrameWork SDK等开发工具包中的源代码中都能找到它的某种实现版本。 快速排序算法是由图灵奖获得者TonyHoare设计出来的,他在形式化方法理论以及AL-GOL60编程语言的发明中都有卓越贡献, ...
分类:编程语言   时间:2020-07-14 13:32:15    阅读次数:70
674. Longest Continuous Increasing Subsequence
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
Array.forEach Array.map Array.filter的用法
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
共35607条   上一页 1 ... 78 79 80 81 82 ... 3561 下一页
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!