class Solution: # @return a string def longestCommonPrefix(self, strs): num_items=len(strs) if num_itemslen(i): pre...
分类:
其他好文 时间:
2014-10-09 15:05:24
阅读次数:
179
Find the intersection of two sorted arrays.Let’s called array1 as A and array2 as B, each with size m and n.The obvious brute-force solution is to sca...
分类:
其他好文 时间:
2014-10-09 14:20:13
阅读次数:
161
/**
* 游戏者接口
* @author stone
*
*/
public interface IGamePlayer {
// 登录游戏
public void login(String user, String password);
// 杀怪,网络游戏的主要特色
public void killBoss();
// 升级
public void upgrade...
分类:
编程语言 时间:
2014-10-09 03:01:50
阅读次数:
206
很久没练只能看别人代码了 1 class Solution { 2 public: 3 int maxProduct(int A[], int n) { 4 if (n == 0) return 0; 5 int curMax, curMin, ans; 6 ...
分类:
其他好文 时间:
2014-10-09 00:48:07
阅读次数:
218
LeetCode 1 class Solution: 2 # @return a string 3 def countAndSay(self, n): 4 if n==1: 5 return "1" 6 else: 7 ...
分类:
其他好文 时间:
2014-10-09 00:28:07
阅读次数:
176
[1]Axure RP是美国Axure Software Solution公司旗舰产品,是一个界面专业的快速原型设计工具,让负责定义需求和规格、设计功能和界面的专家能够快速创建应用软件或Web网站的线框图、流程图、原型和规格说明文档。作为专业的原型设计工具,它能快速、高效的创建原型,同时支持多人协作...
分类:
其他好文 时间:
2014-10-07 22:15:34
阅读次数:
178
Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,3],...
分类:
其他好文 时间:
2014-10-07 20:22:03
阅读次数:
229
解法:(1)建立一个二维数组,记录各位置左侧最高点及右侧最高点,可通过O(n)计算得到。
(2)根据上述信息及当前高度,计算该点竖直方向能容纳多少水,仍是O(n)完成。
综上,渐近时间复杂度为O(n);
class Solution {
public:
int trap(int A[], int n) {
if(n
return 0;
int* hi...
分类:
移动开发 时间:
2014-10-07 15:57:53
阅读次数:
181
/*put all vaild new array from the 0 to new length*/public class Solution { public int removeDuplicates(int[] A) { if(A.length < 2) ...
分类:
其他好文 时间:
2014-10-07 06:55:53
阅读次数:
120
Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"100".类似模拟十进制加法 1 class Solution { 2 public: 3 st...
分类:
其他好文 时间:
2014-10-07 00:00:40
阅读次数:
165