摘要: //DFS超时了。 void dfs(vector<vector<int> > &triangle, int depth, int offset,int curSum,int &min) { if(depth==triangle.size()) { if(min>curSum) min = curSum; return; } curSum += triangle[depth][offset]; dfs(triangle,depth+1,off... 阅读全文
posted @ 2013-06-14 21:51 summer_zhou 阅读(116) 评论(0) 推荐(0) 编辑
摘要: Q: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. 阅读全文
posted @ 2013-06-14 20:26 summer_zhou 阅读(208) 评论(0) 推荐(0) 编辑