出题:一个长度为N的数组,其中的元素取值范围是1到N,要求快速判断数组是否存在重复数字;分析:解法1:如果N个元素的范围都是在1到N,所以如果没有重复元素,则每一个位置恰好可以对应数组中的一个元素之,通过将当前元素k交换到其本身应该在的位
置k,也就是k=array[i], array[array[...
分类:
其他好文 时间:
2014-05-26 03:10:21
阅读次数:
191
Java的Arrays类中有一个sort()方法,该方法是Arrays类的静态方法,在需要对数组进行排序时,非常的好用。但是sort()的参数有好几种,下面我就为大家一一介绍,这几种形式的用法。=====================================================...
分类:
编程语言 时间:
2014-05-26 01:30:26
阅读次数:
398
Remove Duplicates from Sorted Array II
分类:
其他好文 时间:
2014-05-26 01:20:51
阅读次数:
159
Format是一个很常用,却又似乎很烦的方法,本人试图对这个方法的帮助进行一些翻译,让它有一个完整的概貌,以供大家查询之用:首先看它的声明:function
Format(const Format: string; const Args: array of const): string; overl...
分类:
其他好文 时间:
2014-05-25 02:04:12
阅读次数:
416
题目:
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...
分类:
其他好文 时间:
2014-05-25 00:39:37
阅读次数:
343
惠普(HP) LaserJet Pro M1136 MFP 黑白多功能激光一体机 (打印 复印 扫描)新入手的打印机,如果没有安装经验,不要急着开箱组装!先打开电脑,放入驱动光盘,运行安装向导,会有动画安装指南,一步一步的教你如何操作。考虑买这款打印机的可以去产品官方商品页面看看。如果没有驱动光盘,可以去官方产品支持页面下载。下面是我的安装过程:从官网上下载的驱动程序,由于下图中没有完全对应打印机...
分类:
其他好文 时间:
2014-05-24 22:25:25
阅读次数:
367
题目
Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, white and blue.
Here, we will use the i...
分类:
其他好文 时间:
2014-05-24 20:30:21
阅读次数:
342
【题目】
Given an array of strings, return all groups of strings that are anagrams.
Note: All inputs will be in lower-case.
For example:
Input: ["tea","and","ate","eat","den"]
Output: ["tea","ate","eat"]
【题意】
anagrams指的是颠倒字母顺序构成的单词,以tea为例,则与它an...
分类:
其他好文 时间:
2014-05-24 18:36:01
阅读次数:
317
/**
* Created by W.J.Chang on 2014/5/23.
*/
// 判读是否是数组的方法
console.log(Array.isArray(new Array));
console.log(Array.isArray([]));
var arr = [1,2,3];
// 遍历方法
arr.forEach(function (v){
console.log...
分类:
Web程序 时间:
2014-05-24 18:01:08
阅读次数:
305