摘要: QuestionA peak element is an element that is greater than its neighbors.Given an input array wherenum[i] ≠ num[i+1], find a peak element and return it... 阅读全文
posted @ 2015-10-18 13:41 树獭君 阅读(220) 评论(0) 推荐(0) 编辑
摘要: QuestionThe demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid ... 阅读全文
posted @ 2015-10-18 13:18 树獭君 阅读(172) 评论(0) 推荐(0) 编辑
摘要: QuestionThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tota... 阅读全文
posted @ 2015-10-18 09:07 树獭君 阅读(181) 评论(0) 推荐(0) 编辑
摘要: QuestionFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.SolutionThis proble... 阅读全文
posted @ 2015-10-18 04:09 树獭君 阅读(171) 评论(0) 推荐(0) 编辑
摘要: QuestionThen-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all... 阅读全文
posted @ 2015-10-18 03:50 树獭君 阅读(528) 评论(0) 推荐(0) 编辑
摘要: QuestionGiven two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4],... 阅读全文
posted @ 2015-10-18 02:43 树獭君 阅读(206) 评论(0) 推荐(0) 编辑
摘要: QuestionThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the following sequ... 阅读全文
posted @ 2015-10-18 01:22 树獭君 阅读(224) 评论(0) 推荐(0) 编辑
摘要: QuestionGivennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is... 阅读全文
posted @ 2015-10-18 01:07 树獭君 阅读(125) 评论(0) 推荐(0) 编辑