{"id":3971,"date":"2019-11-09T16:59:34","date_gmt":"2019-11-09T08:59:34","guid":{"rendered":"https:\/\/damogame.cn\/wordpress\/?p=3971"},"modified":"2019-11-09T16:59:34","modified_gmt":"2019-11-09T08:59:34","slug":"%e6%9f%a5%e6%89%be%e6%9c%80%e9%95%bf%e7%9a%84%e4%b8%8d%e9%87%8d%e5%a4%8d%e7%9a%84%e5%ad%90%e4%b8%b2%ef%bc%8cleetcode","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/3971","title":{"rendered":"\u67e5\u627e\u6700\u957f\u7684\u4e0d\u91cd\u590d\u7684\u5b50\u4e32\uff0cLeetCode"},"content":{"rendered":"<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\">package main\r\n\r\nimport \"fmt\"\r\n\r\n\/\/\r\n\/\/ \u5224\u65ad\u4e00\u4e2a\u5b57\u7b26\u662f\u5426\u548c\u5b57\u7b26\u4e32\u91cc\u9762\u7684\u5143\u7d20\u91cd\u590d\r\n\/\/\r\n\r\nfunc DupChar(input string, ch byte) bool {\r\n    for i := 0; i &lt; len(input); i++ {\r\n        if ch == input[i] {\r\n            return true\r\n        }\r\n    }\r\n    return false\r\n}\r\n\r\n\/\/\r\n\/\/ \u67e5\u627e\u6700\u957f\u7684\u4e0d\u91cd\u590d\u7684\u5b50\u4e32\r\n\/\/\r\n\r\nfunc FindLongestSubStr(input string) string {\r\n    var ret string\r\n    for i := 0; i &lt; len(input); i++ {\r\n        var this_sub_str string\r\n        for j := i + 1; j &lt; len(input); j++ {\r\n            if DupChar(input[i:j-1], input[j]) {\r\n                this_sub_str = input[i:j]\r\n                break\r\n            }\r\n        }\r\n\r\n        if len(this_sub_str) &gt; len(ret) {\r\n            ret = this_sub_str\r\n        }\r\n    }\r\n\r\n    return ret\r\n}\r\n\r\nfunc main() {\r\n    str := \"ababdcb\"\r\n    substr := FindLongestSubStr(str)\r\n    fmt.Println(substr)\r\n}\r\n<\/pre>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>package main import <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[122],"class_list":["post-3971","post","type-post","status-publish","format-standard","hentry","tag-06-godocker"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3971","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=3971"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/3971\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=3971"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=3971"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=3971"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}