2013年12月27日
摘要: Subsets II2013.12.27 02:47Given a collection of integers that might contain duplicates,S, return all possible subsets.Note:Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets.For example,IfS=[1,2,2], a solution is:[ [2], [1], [1,2,2], [2,2], ... 阅读全文
posted @ 2013-12-27 02:50 zhuli19901106 阅读(432) 评论(0) 推荐(0)
摘要: Decode Ways2013.12.27 02:32A message containing letters fromA-Zis being encoded to numbers using the following mapping:'A' -> 1'B' -> 2...'Z' -> 26Given an encoded message containing digits, determine the total number of ways to decode it.For example,Given encoded me 阅读全文
posted @ 2013-12-27 02:47 zhuli19901106 阅读(245) 评论(0) 推荐(0)
摘要: Gray Code2013.12.27The gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the total number of bits in the code, print the sequence of gray code. A gray code sequence must begin with 0.For example, givenn= 2, return[0,1,3, 阅读全文
posted @ 2013-12-27 02:28 zhuli19901106 阅读(333) 评论(0) 推荐(0)
摘要: Merge Sorted Array2013.12.27 01:18Given two sorted integer arrays A and B, merge B into A as one sorted array.Note:You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B aremandnrespectively.Solution1: First solution is simple and fo. 阅读全文
posted @ 2013-12-27 02:08 zhuli19901106 阅读(227) 评论(0) 推荐(0)