摘要: Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?转自:http://www.cnblogs.com/x1957/p/3406448.html比I麻烦点的就是找到循环开始点TATI只是判断是否循环。要求不使用额外空间(不然hash就可以了按I的思路,我们又慢指针S和快指针F。。。F走两步,S走一步。。。若有环,必定相遇。画个图(很丑勿喷假设在红色凸起的地 阅读全文
posted @ 2014-04-07 20:56 Eason Liu 阅读(1114) 评论(0) 推荐(0) 编辑
摘要: Givennpairs of parentheses, write a function to generate all combinations of well-formed parentheses.For example, givenn= 3, a solution set is:"((()))", "(()())", "(())()", "()(())", "()()()"递归与深搜。 1 class Solution { 2 public: 3 void getRes(vector &a 阅读全文
posted @ 2014-04-07 00:12 Eason Liu 阅读(148) 评论(0) 推荐(0) 编辑