073 Set Matrix Zeroes这道题唯一有点tricky的地方就是 需要O(1) 的space, 这样就利用第一个行 和第一列作为整个matrix的标记位,再用 row 和 col两个作为第一列和第一个行的标志位class Solution: # @param {integer[]...
分类:
其他好文 时间:
2015-07-18 07:04:27
阅读次数:
102
040 Combination Sum II这道题是039 Combination Sum的延伸, 稍作改动就好class Solution: # @param {integer[]} candidates # @param {integer} target # @return {...
分类:
其他好文 时间:
2015-07-18 07:02:33
阅读次数:
106
DescriptionThere are many unsolvable problem in the world.It could be about one or about zero.But this time it is about bigger number.Given an integer...
分类:
其他好文 时间:
2015-07-17 22:24:13
阅读次数:
255
Power of Two
Given an integer, write a function to determine if it is a power of two.
判断给出的数,是否为2的次方,如1,2,4,8,16...
移位操作,2的次方的数,换位2进制表示,都是第一个为1 ,其后面都是0,。如8=1000
class Soluti...
分类:
其他好文 时间:
2015-07-17 21:08:51
阅读次数:
99
Given an integer, write a function to determine if it is a power of two.
[思路]
1)考虑各种边界情况。输入是整型值,说明不用考虑2的负指数情况。
2)如果一个数是二的倍数,说明他的二进制形式只有一位是1。做好判断即可。
循环判断1的位数解法最容易想到。
Leetcode上有种解法,就是让n&n-1,如果n只含有一...
分类:
其他好文 时间:
2015-07-17 21:08:41
阅读次数:
108
对应对象:TApplication 声明:function MessageBox(Text,Caption:PChar;Flags:Word):Integer; 功能:MessageBox方法可以显示一个对话框,在对话框中包含了一条信息和一个及多个按钮。MessageBox方法是TApplicati...
064 Minimum Path Sum纯dpclass Solution: # @param {integer[][]} grid # @return {integer} def minPathSum(self, grid): m = len(grid) ...
分类:
其他好文 时间:
2015-07-17 13:57:54
阅读次数:
132
问题描述:We are asking for a function to take a positive integer value, and return a list of all positive integer pairs whose values - when squared- sum t...
分类:
Web程序 时间:
2015-07-17 13:53:35
阅读次数:
166
034 Search for a Range二分搜索, 搜左右部分稍微有些不同 需要注意class Solution: # @param {integer[]} nums # @param {integer} target # @return {integer[]} def ...
分类:
其他好文 时间:
2015-07-17 13:39:08
阅读次数:
99
canvas 画布 pen 画笔 brush画刷 画布对象 1.moveto(x.y:integer);开始点 2.lineto(x.y:integer);线 3.rectangle(x1.x2.x2.x3);方 4.ellipse(x.y.x1.y1);圆 5.textout(x....
分类:
其他好文 时间:
2015-07-17 13:27:09
阅读次数:
104