2015年6月13日
摘要: The 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 out in a... 阅读全文
posted @ 2015-06-13 17:35 gone~with~wind 阅读(130) 评论(0) 推荐(0) 编辑
摘要: Given a collection of numbers, return all possible permutations.For example,[1,2,3]have the following permutations:[1,2,3],[1,3,2],[2,1,3],[2,3,1],[3,... 阅读全文
posted @ 2015-06-13 16:01 gone~with~wind 阅读(143) 评论(0) 推荐(0) 编辑
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))... 阅读全文
posted @ 2015-06-13 00:31 gone~with~wind 阅读(118) 评论(0) 推荐(0) 编辑
  2015年6月12日
摘要: Given an array withnobjects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, wh... 阅读全文
posted @ 2015-06-12 21:14 gone~with~wind 阅读(129) 评论(0) 推荐(0) 编辑
摘要: Given an integer, convert it to a roman numeral.Input is guaranteed to be within the range from 1 to 3999.1~9: {"I", "II", "III", "IV", "V", "VI", "VI... 阅读全文
posted @ 2015-06-12 15:01 gone~with~wind 阅读(113) 评论(0) 推荐(0) 编辑
摘要: Given a collection of intervals, merge all overlapping intervals.For example,Given[1,3],[2,6],[8,10],[15,18],return[1,6],[8,10],[15,18].思路一:逐一添加元素至ans... 阅读全文
posted @ 2015-06-12 14:34 gone~with~wind 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Givennnon-negative integersa1,a2, ...,an, where each represents a point at coordinate (i,ai).nvertical lines are drawn such that the two endpoints of ... 阅读全文
posted @ 2015-06-12 13:35 gone~with~wind 阅读(106) 评论(0) 推荐(0) 编辑
摘要: Determine whether an integer is a palindrome. Do this without extra space.click to show spoilers.Some hints:Could negative integers be palindromes? (i... 阅读全文
posted @ 2015-06-12 12:59 gone~with~wind 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ... 阅读全文
posted @ 2015-06-12 00:59 gone~with~wind 阅读(120) 评论(0) 推荐(0) 编辑
  2015年6月11日
摘要: Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321click to show spoilers.Have you thought about this?Here are som... 阅读全文
posted @ 2015-06-11 23:56 gone~with~wind 阅读(87) 评论(0) 推荐(0) 编辑