摘要:
本题和 LeetCode 114. Flatten Binary Tree to Linked List 一模一样。doubly linked list 稍微复杂一点。 Recursive PreOrder 和LC114一样,preorder来写的时候要copy next的指针。下面写法同时copy 阅读全文
posted @ 2019-09-16 08:29
約束の空
阅读(223)
评论(0)
推荐(0)
摘要:
The Floyd Warshall Algorithm is for solving the All Pairs Shortest Path problem. The problem is to find the shortest distances between every pair of v 阅读全文
posted @ 2019-09-16 04:23
約束の空
阅读(409)
评论(0)
推荐(0)
摘要:
和3Sum那题非常类似。3Sum我们是固定i,令j=i+1, k=n-1。 本题由于三角形需要两边之和大于第三边,nums[i]+nums[j]>nums[k]。因此我们可以固定k,令i=0, j=k-1。 如果nums[i]+nums[j]>nums[k],说明 [i,j-1] 范围内的所有数作为 阅读全文
posted @ 2019-09-16 02:57
約束の空
阅读(205)
评论(0)
推荐(0)

浙公网安备 33010602011771号