Given an array of integers, every element appears twice except for one. Find that single one....
分类:
其他好文 时间:
2014-05-15 07:20:39
阅读次数:
264
LeetCode-001 Two Sum
Given an array of integers, find two numbers such that they add up to a specific target number.
The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2...
分类:
其他好文 时间:
2014-05-15 04:34:50
阅读次数:
293
方法一:直接定义并且初始化,这种遇到数量少的情况可以用
var _TheArray = [["0-1","0-2"],["1-1","1-2"],["2-1","2-2"]]
方法二:未知长度的二维数组
var tArray = new Array(); //先声明一维
for(var k=0;k
tArray[k]=new Array(); //声明二维,每一个一维...
分类:
Web程序 时间:
2014-05-15 04:11:33
阅读次数:
359
std::auto_ptr 析构的时候调用 delete
操作符来自动释放所包含的对象boost::scoped_ptr / boost::scoped_array不能传递它所包含的对象的所有权
到另一个作用域指针boost::shared_ptr /boost::shared_array在内部记录...
分类:
其他好文 时间:
2014-05-15 02:01:07
阅读次数:
353
Single Number II
Total Accepted: 14472 Total
Submissions: 44420My Submissions
Given an array of integers, every element appears three times except for one. Find that single one.
Note:
Y...
分类:
其他好文 时间:
2014-05-15 01:23:42
阅读次数:
273
program Test;{$APPTYPE CONSOLE}uses System,
System.SysUtils; const Value: array[0..5] of Byte = (5, 72, 101, 76, 76, 111); {
Old ShortString represent...
分类:
其他好文 时间:
2014-05-14 23:42:03
阅读次数:
475
Best Time to Buy and Sell Stock1Say you have an
array for which theithelement is the price of a given stock on dayi.If you were
only permitted to comp...
分类:
其他好文 时间:
2014-05-14 22:36:11
阅读次数:
353
题意:从一个已排序的数组中移除掉重复的元素,每个元素最多可重复两次
思路: 思路和Remove Duplicates from Sorted Array一样,不过要设置一个计数变量,表示当前值出现的次数
出现次数少于2可以加入到新数组,多于2则不可以。每次遇到一个新变量要把计数变量重新设置为1,加入新数组要加1
复杂度:时间O(n), 空间O(1)...
分类:
其他好文 时间:
2014-05-14 21:03:00
阅读次数:
262
获取服务器mac
<?php
/**
获取网卡的MAC地址原码;目前支持WIN/LINUX系统
获取机器网卡的物理(MAC)地址
**/
class GetmacAddr{
var $result = array(); // 返回带有MAC地址的字串数组
var $macAddr;
/*构造*/
function __construct($...
分类:
Web程序 时间:
2014-05-14 20:48:33
阅读次数:
387
Total Accepted: 8400 Total Submissions: 38235 My Submissions
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profi...
分类:
其他好文 时间:
2014-05-14 19:39:53
阅读次数:
275