摘要:
//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... 阅读全文
摘要:
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. 阅读全文