字符串:String都是用String来表示,都是值类型,在传递过程中都会进行拷贝。计算字符数量As3:str.lengthSwift:countElements(str)数组:ArrayAs3:存数任意数据var arr:Array=new Array();var vec:Vector.=new ...
分类:
其他好文 时间:
2014-06-19 06:47:35
阅读次数:
281
JS数组去重var ddd = [1,2,4,5,2, 222,1,5,6];var uq = {};var rq = [];for(var i=0; ib?1:-1});//从小到大排序 alert(arrDemo);//10,50,51,100 arrDemo.sort(function(a,b...
分类:
Web程序 时间:
2014-06-15 06:28:54
阅读次数:
286
一般从数据库中提取数据时,会遇到各种各样类型的数据,要求也不尽相同。自己这两天开发的时候遇到一个很纠结的问题,如下:比如一个二维数组是这样的:Array ( [0] => Array ( [uid] => 231 [username] => 123456 [active] =>aaaa[transf...
分类:
其他好文 时间:
2014-06-14 23:16:36
阅读次数:
223
字符串去重。 var str:String = "->a->b->a->c->d->d"; var res1:Array = str.split('->'); var res:ArrayList = new A...
分类:
其他好文 时间:
2014-06-14 19:49:19
阅读次数:
308
如果这样:private static int unsorted[];for(int i = 1 ; i < 8 ; i ++ )unsorted[i] = 1 ; 是会报NullPointerException的,原因很简单,数组没有初始化!unsorted没有申请到内存空间,for(..)里面的...
分类:
其他好文 时间:
2014-06-14 19:31:53
阅读次数:
170
Given a sorted array, remove the duplicates in place such that each element appear only onceand return the new length.Do not allocate extra space for ...
分类:
其他好文 时间:
2014-06-14 16:59:58
阅读次数:
221
Follow up for ”Remove Duplicates”: What if duplicates are allowed at most twice?For example, Given sorted array A = [1,1,1,2,2,3],Your function should...
分类:
其他好文 时间:
2014-06-14 16:08:32
阅读次数:
200
原始题目如下,意为寻找数组和最大的子串,返回这个最大和即可。
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the...
分类:
其他好文 时间:
2014-06-14 15:08:00
阅读次数:
224
题目
Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero.
Note:
Elements in a triplet (a,b,c) ...
分类:
其他好文 时间:
2014-06-14 12:45:13
阅读次数:
209
题目
Follow up for "Search in Rotated Sorted Array":
What if duplicates are allowed?
Would this affect the run-time complexity? How and why?
Write a function to determine if a given target is in the array.
原题链接(点我)
解题思路
这题和Search in Rotated Sorted Array问题类似,...
分类:
其他好文 时间:
2014-06-14 12:44:18
阅读次数:
266