JS数组定义收藏数组有四种定义的方式 使用构造函数: var a = new Array(); var b = new Array(8); var c = new Array("first", "second", "third"); 或者数组直接量: var d = ["first", "secon...
分类:
Web程序 时间:
2014-07-07 16:36:32
阅读次数:
267
本题就是求所有连续子数列的和开始拿到题目还以为求的时数列子集的和,认真看到题目才知道是连续子数列循环遍历即可 int findSum(vector array) { int sum = 0; for(int i = 0 ; i < array.size(); ++...
分类:
其他好文 时间:
2014-07-07 16:10:42
阅读次数:
179
Problem Description:Given an array of integers, every element appearsthreetimes except for one. Find that single one.Solution:1 Arrays.sort(A...
分类:
其他好文 时间:
2014-07-07 16:10:04
阅读次数:
174
var arr = new Array();
for(var i = 0 ;i < 6 ; i++){
if(i == 0){arr.push(1);}
else if(i == 1){arr = new Array();arr.push(1);arr.push(1);}
else{
var arr2 = new Array();
arr2.push(1);
for(var j = 0;j<ar...
分类:
Web程序 时间:
2014-06-30 09:38:21
阅读次数:
260
Linux下Memcached的安装步骤,如果出现/usr/local/memcached/bin/memcached: error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory异常在/etc/ld.so.conf中加入/usr/local/lib这一行,保存之后,再运行:/sbin/ldconfig –v更新一下配置即可。...
分类:
系统相关 时间:
2014-06-30 09:20:50
阅读次数:
320
只是一个简单的小实验,对比了下 延迟绑定 和 非延迟的效率
延迟绑定主要就是使用 static 关键字来替代原来的 self ,但功能非常强大了
实验代码:
class A {
protected static $cc1 = array('a1', 'b', 'c', 'd');
protected static $cc2 = array('a2', 'b', 'c', 'd')...
分类:
Web程序 时间:
2014-06-30 08:46:02
阅读次数:
183
题目
Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place.
Follow up:
Did you use extra space?
A straight forward solution using O(mn) space is probab...
分类:
其他好文 时间:
2014-06-30 06:17:09
阅读次数:
245
题目
Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified.
You should pack your words in a greedy approa...
分类:
其他好文 时间:
2014-06-29 23:44:02
阅读次数:
357
【题目】
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?
【题意】
给定一个整数以外,其中除了一个整数只出现一次以外...
分类:
其他好文 时间:
2014-06-29 22:52:35
阅读次数:
246
题目
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence...
分类:
其他好文 时间:
2014-06-29 22:16:48
阅读次数:
239