{"id":126030,"date":"2020-05-08T05:30:25","date_gmt":"2020-05-07T21:30:25","guid":{"rendered":"http:\/\/4563.org\/?p=126030"},"modified":"2020-05-08T05:30:25","modified_gmt":"2020-05-07T21:30:25","slug":"%e6%b1%82%e5%8a%a9%e5%a4%a7%e4%bd%ac%e4%bb%ac%e4%b8%80%e4%b8%aa%e8%b7%af%e5%be%84%e8%a7%84%e5%88%92%e7%9a%84%e9%97%ae%e9%a2%98","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=126030","title":{"rendered":"\u6c42\u52a9\u5927\u4f6c\u4eec\u4e00\u4e2a\u8def\u5f84\u89c4\u5212\u7684\u95ee\u9898"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u6c42\u52a9\u5927\u4f6c\u4eec\u4e00\u4e2a\u8def\u5f84\u89c4\u5212\u7684\u95ee\u9898               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : Timefly <\/span>  <span><i><\/i> 12<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\">                        \u539f\u6570\u636e\u7ed3\u6784 [ { from:a, to:b }, {from: b, to: c} , {from: a, to: d}, {from: c, to: d}, { from:c, to :a }, {from:a , to: a}]<\/p>\n<p>\u73b0\u5728\u9700\u8981\u6c42\u8d77\u59cb\u70b9 a \u5230 \u76ee\u6807\u70b9 d , \u6240\u6709\u7684\u8def\u5f84\u6570\u636e \uff0c\u7c7b\u4f3c \u7ed3\u679c \uff1a [ [ a\uff0cb\uff0cc\uff0cd ], [a\uff0cd] ]<br \/>\u6570\u636e\u4e2d\u53ef\u80fd\u4f1a\u6709\u73af\u7684\u60c5\u51b5 {from:a , to: a}<br \/>\u6280\u672f\u6808\u662f javascript<br \/>\u7528\u6df1\u5ea6\u4f18\u5148\u9012\u5f52\u904d\u5386\u4e86\uff0c \u4f46\u662f\u904d\u5386\u7684\u8def\u5f84\u603b\u6709\u4e9b\u95ee\u9898\uff0c\u4e0d\u77e5\u9053\u5199\u6cd5\u6709\u4ec0\u4e48\u4e0d\u5bf9 , \u7b2c\u4e00\u6b21\u53d1\u5e16\u4e0d\u77e5\u9053\u600e\u4e48\u8d34\u56fe\uff0c \u6c42\u5927\u4f6c\u5e2e\u52a9\uff0c\u7ed9\u4e2a\u601d\u8def\u6216\u8005\u89e3\u7b54      <\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>9<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li data-pid=\"2006341\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : also24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u300e\u904d\u5386\u7684\u8def\u5f84\u603b\u6709\u4e9b\u95ee\u9898\u300f \u5177\u4f53\u662f\u4ec0\u4e48\u95ee\u9898\uff1f<\/p>\n<p>\u662f\u5426\u6b63\u786e\u5904\u7406\u4e86\u6210\u73af\u7684\u60c5\u51b5\uff1f <br \/>[ab, bc, ac, cd]<br \/>[a, b, c, a, b, c, d]                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006342\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Timefly <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @also24 \u76ee\u524d\u6211\u5427\u73af\u7684\u6570\u636e\u8fc7\u6ee4\u6389\u4e86\uff0c \u5177\u4f53\u4e3b\u8981\u662f\u8def\u5f84\u4fdd\u5b58\u95ee\u9898\uff0c\u6211\u7528 childPaths=[ ]\u4fdd\u5b58\u904d\u5386\u8def\u5f84, \u6df1\u5ea6\u9012\u5f52\u5230\u4e00\u4e2a\u7ec8\u70b9\u4e0d\u662f \u76ee\u6807\u503c d \u7684\u65f6\u5019\uff0c\u5c31\u4ece childPaths \u4e2d pop \u63a8\u51fa\u6700\u540e\u4e00\u4e2a\uff0c\u7406\u8bba\u4e0a\u611f\u89c9\u6ca1\u5565\u95ee\u9898\uff0c\u4f46\u662f\u7ed3\u679c\u4fdd\u5b58\u4e86\u672a\u6307\u5411 d \u7684\u8def\u5f84\u8bb0\u5f55\uff0c\u660e\u5929\u770b\u770b\u600e\u4e48\u8d34\u56fe\u5927\u4f6c\u770b\u4e0b\uff0c \u6216\u8005\u5927\u4f6c\u80fd\u7ed9\u4e2a\u5927\u6982\u5199\u6cd5\u4e0d                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006343\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : also24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Timefly #2 <br \/>\u8fd8\u662f\u8d34\u4ee3\u7801\u548c\u6837\u4f8b\u76f4\u89c2\u4e00\u4e9b\u3002                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006344\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Timefly <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             \u5bc6\u7801\u5fd8\u4e86\uff0c\u56fe\u5e8a\u94fe\u63a5\u653e\u4e0d\u4e0a\u6765\uff0c \u5c34\u5c2c                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006345\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Timefly <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @also24 \u56fe\u5e8a\u653e\u91cc\u4e86\uff0c \u56de\u590d\u94fe\u63a5\u8981\u9a8c\u8bc1\u624b\u673a\u53f7\uff0c\u5bc6\u7801\u6211\u7ed9\u5fd8\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006346\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : also24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Timefly #5 <br \/>\u554a\uff0cJS \u6211\u4e0d\u719f\u2026\u2026 \u5927\u6982\u770b\u601d\u8def\u6ca1\u611f\u89c9\u5230\u592a\u5927\u95ee\u9898\uff0c\u8d34\u4e0b\u6587\u672c\u5355\u6b65\u8c03\u4e00\u4e0b\u770b\u770b\u3002<\/p>\n<p>https:\/\/gist.github.com\/<\/p>\n<p>https:\/\/pastebin.com\/<\/p>\n<p>https:\/\/paste.ubuntu.com\/                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006347\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Timefly <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @also24 :\/\/gist.github.com\/ironmancaijian\/fe60d1edf9d11d8b5a0288aaafe4e5bc \u8d34\u597d\u4e86\u5927\u4f6c\uff0c\u9ebb\u70e6\u5927\u4f6c\u4e86                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006348\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : also24 <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @Timefly #7 <br \/>\u6211\u770b\u4e86\u4e00\u4e0b\uff0c\u5927\u6982\u770b\u5230\u4e24\u4e2a\u95ee\u9898<br \/>1 \u3001\u4f60\u7684 47 \u884c dfs(nextData &#8230;..) \u8fd9\u91cc\uff0c\u4f20\u5165\u7684 nextData\uff0c\u91cc\u9762\u7684 isVisit \u4f3c\u4e4e\u6ca1\u6709\u505a\u5904\u7406\uff0c\u8fd9\u5bfc\u81f4 a-&gt;h-&gt;d-&gt;e \u8fd9\u6761\u8def\u5f84\u8dd1\u4e0d\u51fa\u6765\u3002<\/p>\n<p>2 \u3001\u6211\u53ea\u770b\u5230\u4f60\u6807\u8bb0\u4e86\u5df2\u88ab\u4f7f\u7528\u7684\u8def\u5f84\uff0c\u4f46\u662f\u4f3c\u4e4e\u6ca1\u6709\u5904\u7406\u91cd\u590d\u4f7f\u7528\u7684\u70b9\uff0c\u8fd9\u6837\u8fd8\u662f\u5b58\u5728\u6210\u73af\u7684\u53ef\u80fd\uff0c\u5efa\u8bae\u7528\u4e00\u4e2a map \u76f4\u63a5\u628a\u5df2\u7ecf\u8d70\u8fc7\u7684\u70b9\u5b58\u8d77\u6765\uff0c\u8fd9\u6837\u5c31\u53ef\u4ee5\u4e0d\u7528\u6807\u8bb0\u8def\u5f84\u7684 isVisit \u4e86\u3002<\/p>\n<p>\u6bd4\u5982\u8bf4\u5728\u8fd9\u6837\u7684\u60c5\u51b5\u4e0b\uff1a<br \/>a-&gt;b, b-&gt;c , c-&gt;a <\/p>\n<p>\u867d\u7136\u6ca1\u6709\u8d70\u91cd\u590d\u8def\u5f84\uff0c\u4f46\u662f a \u70b9\u88ab\u8d70\u4e86\u4e24\u6b21\uff0c\u5b9e\u9645\u4e0a\u5df2\u7ecf\u6210\u73af\u4e86\u3002                                                            <\/p><\/div>\n<\/p><\/div>\n<\/li>\n<li data-pid=\"2006349\" data-uid=\"2\">\n<div>\n<div>\n<div> <span>\u4e3b<\/span> <span>\u8cc7\u6df1\u5927\u4f6c : Timefly <\/span>  <\/div>\n<div> <i title=\"\u5f15\u7528\"><\/i>  <span>          <\/span> <\/div>\n<\/p><\/div>\n<div>                                                             @also24 \u521a\u770b\u5230\uff0c\u5df2\u7ecf\u89e3\u51b3\u4e86\uff0c\u5176\u5b9e\u662f\u8fb9\u754c\u6761\u4ef6\u6ca1\u5904\u7406\u597d\uff0c\u7b2c\u4e00\u70b9\u5c31\u662f \u5728 for \u5faa\u73af\u7ed3\u675f\u7684\u65f6\u5019\uff0c \u9700\u8981\u6267\u884c childRes.pop() \u4ece childRes \u4e2d\u63a8\u51fa\u4e00\u6761\u8bb0\u5f55\uff0c \u4e0d\u7136\u4f1a\u53e0\u52a0\u65e0\u7528\u8bb0\u5f55\uff0c \u7b2c\u4e8c\u70b9\u5c31\u662f\u8fd9\u4e2a isVisit \u7684\u95ee\u9898\uff0c \u4ee3\u7801 39 \u884c\u5df2\u7ecf\u8fc7\u6ee4\u4e86 isVisit \u7684\u6570\u636e\u4e86\uff0c \u4f46\u662f\u9700\u8981\u591a\u6392\u9664\u6389 a -&gt;b b-&gt;a \u7684\u60c5\u51b5\uff0c \u975e\u5e38\u611f\u8c22\u5927\u4f6c\u7684\u56de\u590d\uff5e                                                            <\/div>\n<\/p><\/div>\n<\/li>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u6c42\u52a9\u5927\u4f6c\u4eec\u4e00\u4e2a\u8def\u5f84\u89c4\u5212\u7684\u95ee\u9898 \u8cc7\u6df1&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/126030"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=126030"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/126030\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=126030"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=126030"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=126030"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}