STL之vector篇 N久之前是拿C的数组实现过vector中的一些简单功能,什么深拷贝、增删查找之类的,以为vector的实现也就是这样了,现在想想真是...too young too naive...ORZ 我是分割线 vector属于顺序容器,它的底层实现就是基于array,所以它可以支持随 ...
分类:
编程语言 时间:
2016-03-31 20:26:06
阅读次数:
295
Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return ...
分类:
其他好文 时间:
2016-03-31 18:33:57
阅读次数:
143
有时候项目中NSArray和NSMutableArray需要相互转化,下面给出相关代码1.NSArray 1.1 转化:NSMutableArray 1 NSMutableArray *mutableArray = [NSMutableArray arrayWithArray:array]; // ...
分类:
其他好文 时间:
2016-03-31 18:25:05
阅读次数:
124
Maximum Product Subarray
Find the contiguous subarray within an array (containing at least one number) which has the largest product.
For example, given the array [2,3,-2,4],
the contiguous s...
分类:
编程语言 时间:
2016-03-31 17:02:53
阅读次数:
206
c++引入模板是为了更好的代码复用,模板这边分为两个大块.1.模板函数2.模板类我们今天来介绍模板类的应用—顺序表和链表(单链表为例)//模板的顺序表
template<classT>
classSeqList
{
public:
SeqList()
:_array(NULL)
,_size(0)
,_capacity(0)
{}
~SeqList..
分类:
其他好文 时间:
2016-03-31 15:03:29
阅读次数:
185
Given an integer array, adjust each integers so that the difference of every adjacent integers are not greater than a given number target. If the arra ...
分类:
其他好文 时间:
2016-03-31 14:18:06
阅读次数:
141
JS中数组有很多操作,作为前端多多少少知道点,但每次要用时都需要去百度,有点麻烦,所以在这儿做个备忘,简单总结些平时最常用的数组操作。 shift:删除原数组第一项,并返回删除元素的值; unshift:将参数添加到原数组开头,并返回数组的长度 pop:删除原数组最后一项,并返回删除元素的值; pu ...
分类:
编程语言 时间:
2016-03-31 12:37:36
阅读次数:
312
PHP中array_multisort可以用来一次对多个数组进行排序,或者根据某一维或多维对多维数组进行排序。 关联(string)键名保持不变,但数字键名会被重新索引。 输入数组被当成一个表的列并以行来排序——这类似于 SQL 的 ORDER BY 子句的功能。第一个数组是要排序的主要数组。数组中 ...
分类:
Web程序 时间:
2016-03-31 10:50:53
阅读次数:
141
Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. ...
分类:
其他好文 时间:
2016-03-31 10:42:16
阅读次数:
142