说明:找到最大的数,排列到最后面,然后继续找 例: $arr = array(3,5,-1,0,2); for($i=0;$i<count($arr)-1;$i++){ for($j=0;$j<count($arr)-1-$i;$j++){ if($arr[$j]>$arr[$j+1]){ $tem ...
分类:
编程语言 时间:
2016-03-31 09:31:23
阅读次数:
235
Given an unsorted array of integers, find the length of longest increasing subsequence. For example, Given [10, 9, 2, 5, 3, 7, 101, 18], The longest i ...
分类:
其他好文 时间:
2016-03-31 09:30:48
阅读次数:
142
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr ...
分类:
其他好文 时间:
2016-03-31 02:01:34
阅读次数:
183
Given an array of integers and an integer k, find out whether there are two distinct indices i and j in the array such that nums[i] = nums[j] and the ...
分类:
其他好文 时间:
2016-03-31 01:40:12
阅读次数:
113
array_change_key_case — 返回字符串键名全为小写或大写的数组 array_chunk — 将一个数组分割成多个 array_column — 返回数组中指定的一列 array_combine — 创建一个数组,用一个数组的值作为其键名,另一个数组的值作为其值 array_cou ...
分类:
编程语言 时间:
2016-03-30 23:59:41
阅读次数:
410
我们知道c++标准库中定义了智能指针auto_ptr,但是我们很少用它,因为虽然它能够自动回收动态开辟的内存,不需要程序员自己去维护动态开辟的内存,但是当用它去赋值或者是拷贝构造时有一个管理权转移的过程,这样我们就不能很方便的使用auto_ptr。下面是简单的auto_ptr的实现,..
分类:
编程语言 时间:
2016-03-30 18:04:49
阅读次数:
245
1、什么是ArrayList ArrayList就是传说中的动态数组,用MSDN中的说法,就是Array的复杂版本,它提供了如下一些好处: 动态的增加和减少元素 实现了ICollection和IList接口 灵活的设置数组的大小 2、如何使用ArrayList 最简单的例子:ArrayList Li ...
分类:
其他好文 时间:
2016-03-30 16:15:48
阅读次数:
189
static void Main(string[] args) { int[,] nums = new int[3, 5]; Console.WriteLine(nums.Length); Console.WriteLine(nums.LongLength); Console.WriteLine(n ...
分类:
其他好文 时间:
2016-03-30 14:48:34
阅读次数:
210
Given an array of integers, find two non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguous.Return the ...
分类:
其他好文 时间:
2016-03-30 14:34:53
阅读次数:
173
Given an array nums and a target value k, find the maximum length of a subarray that sums to k. If there isn't one, return 0 instead. Example 1: Given ...
分类:
编程语言 时间:
2016-03-30 12:56:33
阅读次数:
249