这两个题,都是用bit operation解决的,但是第二个稍微tricky一点。先说第一个,我们利用XOR, 如果一个数字出现两次,那么在每一位上,两两抵消。唯独那个只出现一次的,没有另一半和它抵消了。。所以就剩下了。 1 public int singleNumber(int[] A) ...
分类:
其他好文 时间:
2015-04-10 08:15:03
阅读次数:
108
xcode6中新建空工程(2014-10-29 13:14:44)转载▼标签:itios分类: iOS 升级xcode6之后,直接建立Empty工程后发现,这是太坑,真的是什么都没有啊。只能换个方法了总结如下: 1.新建一个single view application 2.打开 Info.pli....
分类:
其他好文 时间:
2015-04-09 15:27:08
阅读次数:
115
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2015-04-09 15:16:42
阅读次数:
103
原文地址:http://www.cnblogs.com/aoyeyuyan/p/4388110.html一·单一职责原则(Single-Responsibility Principle) 定义:一个对象应该只包含单一的职责,并且该职责被完整地封装在一个类中。 宿舍里并不能好好学习,自习还...
分类:
其他好文 时间:
2015-04-09 10:15:55
阅读次数:
213
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single ...
分类:
其他好文 时间:
2015-04-08 22:55:54
阅读次数:
142
ES6可以使用“箭头”(=>)定义函数,注意是函数,不要使用这种方式定义类(构造器)。一、语法1.具有一个参数的简单函数var single = a => asingle('hello, world') // 'hello, world' 2.没有参数的需要用在箭头前加上小括号var log = ....
分类:
其他好文 时间:
2015-04-08 19:34:30
阅读次数:
129
一·单一职责原则(Single-ResponsibilityPrinciple) 定义:一个对象应该只包含单一的职责,并且该职责被完整地封装在一个类中。 宿舍里并不能好好学习,自习还是得去图书馆。这是一条颠扑不破的真理!被无数学子千百次的实践所证明!我就想不通了,宿舍里有桌有椅,能上床小睡...
分类:
其他好文 时间:
2015-04-08 12:44:13
阅读次数:
165
异或满足交换律,结合律任何数X^X=0,X^0=X自反性 A XOR B XOR B = A xor 0 = A设有A,B两个变量,存储的值分别为a,b,则以下三行表达式将互换他们的值 表达式 (值) :A=A XOR B (a XOR b)B=B XOR A (b XOR a XOR b = a)...
分类:
其他好文 时间:
2015-04-08 10:51:53
阅读次数:
138
Implement wildcard pattern matching with support for '?' and '*'.'?' Matches any single character.'*' Matches any sequence of characters (including th...
分类:
其他好文 时间:
2015-04-08 06:33:45
阅读次数:
123
S.O.L.I.D是面向对象设计和编程(OOD&OOP)中几个重要编码原则(Programming Priciple)的首字母缩写。SRPThe Single Responsibility Principle单一责任原则OCPThe Open Closed Principle开放封闭原则LSPThe...
分类:
其他好文 时间:
2015-04-07 23:15:39
阅读次数:
250