摘要: Given a set of candidate numbers (C) and a target number (T), find all unique combinations inCwhere the candidate numbers sums toT.Thesamerepeated num... 阅读全文
posted @ 2014-01-30 15:36 Averill Zheng 阅读(285) 评论(0) 推荐(0) 编辑
摘要: Determine if a Sudoku is valid, according to:Sudoku Puzzles - The Rules.The Sudoku board could be partially filled, where empty cells are filled with the character'.'.A partially filled sudoku which is valid.Here is a brute force method. I do not whether there is an other smart method. 1 pub 阅读全文
posted @ 2014-01-30 09:32 Averill Zheng 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given an unsorted integer array, find the first missing positive integer.For example,Given[1,2,0]return3,and[3,4,-1,1]return2.Your algorithm should run inO(n) time and uses constant space. 1 public class Solution{ 2 public int firstMissingPositive(int[] A){ 3 int result = 1; //if the... 阅读全文
posted @ 2014-01-30 08:16 Averill Zheng 阅读(140) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression inReverse Polish Notation.Valid operators are+,-,*,/. Each operand may be an integer or another expression.Some examples: ["2", "1", "+", "3", "*"] -> ((2 + 1) * 3) -> 9 ["4", "13&qu 阅读全文
posted @ 2014-01-30 06:57 Averill Zheng 阅读(118) 评论(0) 推荐(0) 编辑