Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Jun 29, 2020
1 parent 52bc3e5 commit ab81661
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion DFS/332.Reconstruct-Itinerary/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,6 @@ A -> B <-> F

那我们构造欧拉路径的思想是:B + path2 + path1,其中path1是从B点出发,选择任意支路并能够顺利走到终点的欧拉路径。path2是在path1走完之后,再从B点出发,最终走回B点的路径。注意,如果足够幸运,path1走遍了B后面的所有边,那么path2就不存在了。

因为我们要最小化字典序,所以我们每次的分叉总会优先选择字典序较小的一支。
因为我们要最小化字典序,所以我们每次的分叉总会优先选择字典序较小的一支。如果这一支是类似上例中的"->D->E"这样直通到底的path1,那我们也无能为力,D注定是无法往前提的;否则的话我们就会先进入path2,从而更小化了整个欧拉路径的字典序。

[Leetcode Link](https://leetcode.com/problems/reconstruct-itinerary)

0 comments on commit ab81661

Please sign in to comment.