摘要:
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... 阅读全文
摘要:
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 ... 阅读全文
摘要:
QuestionThe gray code is a binary numeral system where two successive values differ in only one bit.Given a non-negative integernrepresenting the tota... 阅读全文
摘要:
QuestionFollow up for N-Queens problem.Now, instead outputting board configurations, return the total number of distinct solutions.SolutionThis proble... 阅读全文
摘要:
QuestionThen-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all... 阅读全文
摘要:
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],... 阅读全文
摘要:
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... 阅读全文
摘要:
QuestionGivennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is... 阅读全文