摘要:
Given a linked list, remove thenthnode from the end of list and return its head.For example, Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5.Note:Givennwill always be valid.Try to do this in one pass. 1 阅读全文
posted @ 2014-02-04 16:38
Razer.Lu
阅读(234)
评论(0)
推荐(0)
摘要:
A 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 message"12", it cou 阅读全文
posted @ 2014-02-04 16:32
Razer.Lu
阅读(249)
评论(0)
推荐(0)
摘要:
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindrome partitioning ofs.For example, givens="aab",Return1since the palindrome partitioning["aa","b"]could be produced using 1 cut.[Thoughts]凡是求 阅读全文
posted @ 2014-02-04 15:06
Razer.Lu
阅读(228)
评论(0)
推荐(0)
摘要:
Given a 2D board containing'X'and'O', capture all regions surrounded by'X'.A region is captured by flipping all'O's into'X's in that surrounded region .For example,X X X XX O O XX X O XX O X XAfter running your function, the board should be:X X X XX X X XX X X 阅读全文
posted @ 2014-02-04 14:23
Razer.Lu
阅读(232)
评论(0)
推荐(0)
摘要:
Given a strings, partitionssuch that every substring of the partition is a palindrome.Return all possible palindrome partitioning ofs.For example, givens="aab",Return [ ["aa","b"], ["a","a","b"] ]【解题思路】DFS 找到s的所有的substring, 判断是否是palindrome, 阅读全文
posted @ 2014-02-04 03:49
Razer.Lu
阅读(181)
评论(0)
推荐(0)

浙公网安备 33010602011771号