摘要:
Given a sorted array, remove the duplicates in place such that each element appear only once and return the new length. Do not allocate extra space fo 阅读全文
posted @ 2017-02-15 13:54
notesbuddy
阅读(138)
评论(0)
推荐(0)
摘要:
Given a linked list, swap every two adjacent nodes and return its head. For example,Given 1->2->3->4, you should return the list as 2->1->4->3. Your a 阅读全文
posted @ 2017-02-15 11:41
notesbuddy
阅读(108)
评论(0)
推荐(0)
摘要:
Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 两种方法: (1) 类似于归并排序,把链表数组分割成两两最小的链表对(可能存在落单的情况,要做处理), 阅读全文
posted @ 2017-02-15 11:21
notesbuddy
阅读(142)
评论(0)
推荐(0)
摘要:
Given n pairs of parentheses, write a function to generate all combinations of well-formed parentheses. For example, given n = 3, a solution set is:[ 阅读全文
posted @ 2017-02-15 10:45
notesbuddy
阅读(198)
评论(0)
推荐(0)
摘要:
转自 一亩三分地的 回复: http://www.1point3acres.com/bbs/thread-172641-1-1.html 所谓Backtracking都是这样的思路:在当前局面下,你有若干种选择。那么尝试每一种选择。如果已经发现某种选择肯定不行(因为违反了某些限定条件),就返回;如果 阅读全文
posted @ 2017-02-15 00:52
notesbuddy
阅读(211)
评论(0)
推荐(0)