{"id":233,"date":"2019-07-21T16:46:59","date_gmt":"2019-07-21T08:46:59","guid":{"rendered":"https:\/\/kanghaov.com\/?p=233"},"modified":"2019-08-08T19:06:21","modified_gmt":"2019-08-08T11:06:21","slug":"%e6%8c%91%e6%88%98%e5%ad%97%e7%ac%a6%e4%b8%b2","status":"publish","type":"post","link":"https:\/\/nemo.cool\/233.html","title":{"rendered":"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32"},"content":{"rendered":"<p>[TOC]<\/p>\n<h2>1.\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32<\/h2>\n<p><strong>\u5173\u952e\u5b57\uff1a<\/strong>\u54c8\u5e0c\u8868\u3001\u53cc\u6307\u9488\u3001\u5b57\u7b26\u4e32\u3001Sliding Window<\/p>\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684 <strong>\u6700\u957f\u5b50\u4e32<\/strong> \u7684\u957f\u5ea6\u3002<\/p>\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;abcabcbb&amp;quot;\n\u8f93\u51fa: 3\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;abc&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002<\/code><\/pre>\n<p><strong>\u793a\u4f8b 2:<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;bbbbb&amp;quot;\n\u8f93\u51fa: 1\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;b&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 1\u3002<\/code><\/pre>\n<p><strong>\u793a\u4f8b 3:<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;pwwkew&amp;quot;\n\u8f93\u51fa: 3\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;wke&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002\n     \u8bf7\u6ce8\u610f\uff0c\u4f60\u7684\u7b54\u6848\u5fc5\u987b\u662f \u5b50\u4e32 \u7684\u957f\u5ea6\uff0c&amp;quot;pwke&amp;quot; \u662f\u4e00\u4e2a\u5b50\u5e8f\u5217\uff0c\u4e0d\u662f\u5b50\u4e32\u3002<\/code><\/pre>\n<h3>\u89e3\u7b54<\/h3>\n<p>\u4f20\u7edf\u7684\u89e3\u6cd5\u662f\u66b4\u529b\u7834\u89e3\uff0c\u5148\u7f57\u5217\u51fa\u8fd9\u4e2a\u5b57\u7b26\u4e32\u7684\u6240\u6709\u5b50\u4e32\u7136\u540e\u4f9d\u6b21\u5224\u65ad\u8fd9\u4e9b\u5b50\u4e32\u4e2d\u662f\u5426\u542b\u6709\u76f8\u540c\u5b57\u7b26\uff0c\u8fd9\u6837\u505a\u592a\u6162\u4e86<\/p>\n<p>\u4e0b\u9762\u4ecb\u7ecd<strong>\u6ed1\u52a8\u7a97\u53e3<\/strong>\u6c42\u6700\u5927\u5b50\u4e32\uff1a<\/p>\n<p>\u201c\u6ed1\u52a8\u7a97\u53e3\u201d\u8fd9\u4e2a\u6982\u5ff5\u5728\u8ba1\u7b97\u673a\u7b97\u6cd5\u4e2d\u975e\u5e38\u5e38\u89c1\u3002\u8be5\u7b97\u6cd5\u53ef\u4ee5\u628a\u5d4c\u5957\u7684\u5faa\u73af\u8f6c\u5316\u4e3a\u5355\u5faa\u73af\u4ece\u800c\u964d\u4f4e\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u5b83\u5728\u5f88\u591a\u4e0d\u540c\u7684\u9886\u57df\u90fd\u6709\u5e94\u7528\uff1a<\/p>\n<p>1.TCP\u534f\u8bae\u7684\u6ed1\u52a8\u7a97\u53e3\u8fdb\u884c\u6d41\u91cf\u63a7\u5236<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kanghaov-img-1256185664.file.myqcloud.com\/2019\/07\/20\/5d3318be19461.jpeg\" alt=\"nyp4cfd20f.jpeg\" \/><\/p>\n<p>2.NLP\uff08\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff09\u4e2d\u7684 N-gram<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kanghaov-img-1256185664.file.myqcloud.com\/2019\/07\/20\/5d331926e8fff.png\" alt=\"b4v7yrd760.png\" \/><\/p>\n<p>3.\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u7269\u4f53\u8bc6\u522b<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kanghaov-img-1256185664.file.myqcloud.com\/2019\/07\/20\/5d331b7323018.jpeg\" alt=\"prguysjfaj.jpeg\" \/><\/p>\n<p>\u4e0b\u9762\u5f00\u59cb\u4f7f\u7528<strong>\u6ed1\u52a8\u7a97\u53e3<\/strong>\u6c42\u89e3\u6700\u5927\u5b50\u4e32\uff0c\u4f8b\u5982\u9898\u76ee\u4e2d\u7684\u2018abcabcbb\u2019\u4f8b\u5b50\uff1a<\/p>\n<p>\u5f00\u59cb\u7684\u65f6\u5019\uff0cbegin\u548cend\u90fd\u6307\u54110\u7684\u4f4d\u7f6e\u5373\u2018a\u2019\uff0c\u7136\u540eend\u4e0d\u65ad\u540e\u79fb\uff08\u7a97\u53e3\u53d8\u5bbd\uff09\uff0c\u5f53\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\uff08\u9047\u89c1\u91cd\u590d\u5b57\u7b26\uff09\u5c31\u5f97\u5230\u4e00\u4e2a\u5b50\u4e32\uff0c\u5176\u957f\u5ea6\u5c31\u662fend\u548cbegin\u4f4d\u7f6e\u7684\u5dee\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kanghaov-img-1256185664.file.myqcloud.com\/2019\/07\/20\/5d331c1d29b14.jpeg\" alt=\"6sextj6x7y.jpeg\" \/><\/p>\n<p><strong>\u5982\u4f55\u5224\u65ad\u662f\u5426\u9047\u5230\u4e86\u91cd\u590d\u5b57\u7b26\u2018a\u2019\u5462\uff1f<\/strong>\u9700\u8981\u4e00\u4e2a\u5b57\u5178\u4f5c\u4e3a\u8f85\u52a9\u6570\u636e\u7ed3\u6784\uff0c\u628aend\u4ece\u5934\u5f00\u59cb\u9047\u5230\u7684\u6bcf\u4e2a\u5b57\u7b26\u53ca\u5176\u7d22\u5f15\u4f4d\u7f6e\u90fd\u653e\u5230\u5b57\u5178\u91cc\u9762\uff0cend\u6bcf\u6b21\u79fb\u52a8\u5230\u65b0\u5b57\u7b26\u5c31\u67e5\u4e00\u4e0b\u5b57\u5178\u5373\u53ef\u3002<\/p>\n<p>\u901a\u8fc7\u5b57\u5178\uff0c\u6211\u4eec\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\u5c31\u53ef\u4ee5\u627e\u5230\u5b58\u5728\u5b57\u5178\u91cc\u9762\u7684\u7b2c\u4e00\u4e2a\u2018a\u2019\u7684\u4f4d\u7f6e\u3002\u4e3a\u4e86\u7ee7\u7eed\u5bfb\u627e\u65e0\u91cd\u590d\u5b50\u4e32\uff0cbegin\u5c31\u8981\u6307\u5411\u7b2c\u4e00\u4e2a\u2018a\u2019\u540e\u9762\u4e00\u4e2a\u7684\u4f4d\u7f6e\u5373\u2018b\u2019\u3002\u7136\u540eend\u7ee7\u7eed\u540e\u79fb\u5230\u2018b\u2019\uff0c\u6709\u53d1\u73b0\u5b83\u4e0e\u524d\u9762\u7684\u2018b\u2019\u91cd\u590d\uff0c\u8ba1\u7b97\u5b50\u4e32\u957f\u5ea6\u8d4b\u503c\u7ed9\u6700\u5927\u957f\u5ea6\uff08\u9700\u8981\u6bd4\u8f83\uff09\uff0c\u540c\u65f6begin\u8981\u79fb\u52a8\u7b2c\u4e00\u4e2a\u2018b\u2019\u540e\u9762\u7684\u4f4d\u7f6e\u5373\u2018c\u2019\u3002<\/p>\n<p>\u8fd9\u6837\u4f9d\u6b21\u79fb\u52a8end\u5230\u5b57\u7b26\u4e32\u672b\u5c3e\u5c31\u53ef\u4ee5\u627e\u5230\u6700\u957f\u7684\u5b50\u4e32\uff0c\u201c\u5b50\u4e32\u7a97\u53e3\u201d\u4e5f\u5c31\u4ece\u5934\u79fb\u5230\u4e86\u672b\u5c3e\u3002\u800c\u53ea\u9700\u8981end\u4ece\u5934\u5230\u5c3e\u7684\u4e00\u6b21\u5faa\u73af\u5373\u53ef\u3002<\/p>\n<pre><code class=\"language-python\">class Solution(object):\n    def lengthOfLongestSubstring(self, s):\n        &amp;quot;&amp;quot;&amp;quot;\n        :type s: str\n        :rtype: int\n        &amp;quot;&amp;quot;&amp;quot;\n        maxlen = 0\n        memo = dict()\n        begin, end = 0, 0\n        n = len(s)\n        while end &amp;lt; n:\n            last = memo.get(s[end])\n            memo[s[end]] = end\n            if last is not None:\n                maxlen = max(maxlen, end-begin)\n                begin = max(begin, last + 1)\n            end += 1\n        maxlen = max(maxlen, end-begin)\n        return maxlen<\/code><\/pre>\n<p>\u6216\u8005\uff1a<\/p>\n<pre><code class=\"language-python\">def lengthOfLongestSubstring(self, s):\n        &amp;quot;&amp;quot;&amp;quot;\n        :type s: str\n        :rtype: int\n        &amp;quot;&amp;quot;&amp;quot;\n        ans = 0\n        start = 0\n        end = 0\n        StrSet = set()\n        while start &amp;lt; len(s) and end &amp;lt; len(s):\n            StrLen = len(StrSet)\n            StrSet.add(s[end])\n            if not StrLen == len(StrSet):\n                end += 1\n                ans = max(ans, end - start)\n            else:\n                StrSet.remove(s[start])\n                start += 1\n        return ans<\/code><\/pre>\n<h2>2.\u6700\u957f\u516c\u5171\u524d\u7f00<\/h2>\n<p><strong>\u5173\u952e\u5b57\uff1a<\/strong><\/p>\n<p>\u7f16\u5199\u4e00\u4e2a\u51fd\u6570\u6765\u67e5\u627e\u5b57\u7b26\u4e32\u6570\u7ec4\u4e2d\u7684\u6700\u957f\u516c\u5171\u524d\u7f00\u3002<\/p>\n<p>\u5982\u679c\u4e0d\u5b58\u5728\u516c\u5171\u524d\u7f00\uff0c\u8fd4\u56de\u7a7a\u5b57\u7b26\u4e32 <code>&quot;&quot;<\/code>\u3002<\/p>\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n<pre><code>\u8f93\u5165: [&amp;quot;flower&amp;quot;,&amp;quot;flow&amp;quot;,&amp;quot;flight&amp;quot;]\n\u8f93\u51fa: &amp;quot;fl&amp;quot;<\/code><\/pre>\n<p><strong>\u793a\u4f8b 2:<\/strong><\/p>\n<pre><code>\u8f93\u5165: [&amp;quot;dog&amp;quot;,&amp;quot;racecar&amp;quot;,&amp;quot;car&amp;quot;]\n\u8f93\u51fa: &amp;quot;&amp;quot;\n\u89e3\u91ca: \u8f93\u5165\u4e0d\u5b58\u5728\u516c\u5171\u524d\u7f00\u3002<\/code><\/pre>\n<p><strong>\u8bf4\u660e:<\/strong><\/p>\n<p>\u6240\u6709\u8f93\u5165\u53ea\u5305\u542b\u5c0f\u5199\u5b57\u6bcd <code>a-z<\/code> \u3002<\/p>\n<h3>\u89e3\u7b54<\/h3>\n<p>\u53d6\u4e0d\u540c\u5b57\u7b26\u4e32\u4e2d\u540c\u4e00\u4f4d\u7f6e\u7684\u5b57\u7b26\uff0c\u67e5\u770b\u662f\u5426\u76f8\u540c\u3002<\/p>\n<pre><code class=\"language-python\">class Solution(object):\n    def longestCommonPrefix(self, strs):\n        &amp;quot;&amp;quot;&amp;quot; :type strs: List[str] :rtype: str &amp;quot;&amp;quot;&amp;quot;\n        res =&amp;quot;&amp;quot; #\u521b\u5efa\u4e00\u4e2a\u7a7a\u5b57\u7b26\u4e32\n        if len(strs)==0:\n            return res\n\n        temp = strs[0]\n        for str in strs:\n            if len(temp) &amp;gt; len(str):\n                temp = str #\u627e\u51fa\u6700\u77ed\u7684\u5b57\u7b26\u4e32\u4f5c\u4e3a\u6a21\u7248\n        for i in range(0,len(temp)):\n            for j in range(0,len(strs)):\n                if strs[j][i]!=temp[i]:\n                    return res;\n            res = res + temp[i]\n        return res;<\/code><\/pre>\n<p>\u5176\u4ed6\u9898\u89e3<a href=\"https:\/\/leetcode-cn.com\/problems\/longest-common-prefix\/solution\/duo-chong-si-lu-qiu-jie-by-powcai-2\/\">\u8fd9\u91cc<\/a><\/p>\n<blockquote>\n<p>\u601d\u8def\uff1a<br \/>\n\u601d\u8def 1\uff1a<br \/>\nPython \u7279\u6027\uff0c\u53d6\u6bcf\u4e00\u4e2a\u5355\u8bcd\u7684\u540c\u4e00\u4f4d\u7f6e\u7684\u5b57\u6bcd\uff0c\u770b\u662f\u5426\u76f8\u540c\u3002<\/p>\n<p>\u601d\u8def 2\uff1a<br \/>\n\u53d6\u4e00\u4e2a\u5355\u8bcd s\uff0c\u548c\u540e\u9762\u5355\u8bcd\u6bd4\u8f83\uff0c\u770b s \u4e0e\u6bcf\u4e2a\u5355\u8bcd\u76f8\u540c\u7684\u6700\u957f\u524d\u7f00\u662f\u591a\u5c11\uff01\u904d\u5386\u6240\u6709\u5355\u8bcd<\/p>\n<p>\u601d\u8def 3\uff1a<br \/>\n\u6309\u5b57\u5178\u6392\u5e8f\u6570\u7ec4\uff0c\u6bd4\u8f83\u7b2c\u4e00\u4e2a\uff0c\u548c\u6700\u540e\u4e00\u4e2a\u5355\u8bcd\uff0c\u6709\u591a\u5c11\u524d\u7f00\u76f8\u540c\u3002<\/p>\n<p>\u4ee3\u7801:<br \/>\n\u601d\u8def\u4e00\uff1a<\/p>\n<pre><code>class Solution:\n def longestCommonPrefix(self, strs):\n     \"\"\"\n     :type strs: List[str]\n     :rtype: str\n     \"\"\"\n     res = \"\"\n     for tmp in zip(*strs):\n         tmp_set = set(tmp)\n         if len(tmp_set) == 1:\n             res += tmp[0]\n         else:\n             break\n     return res\n<\/code><\/pre>\n<pre><code>\u601d\u8def\u4e8c\uff1a\nPythonJava\nclass Solution:\n def longestCommonPrefix(self, s: List[str]) -&gt; str:\n     if not s:\n         return \"\"\n     res = s[0]\n     i = 1\n     while i &lt; len(s):\n         while s[i].find(res) != 0:\n             res = res[0:len(res)-1]\n         i += 1\n     return res\n<\/code><\/pre>\n<pre><code>\u601d\u8def\u4e09\uff1a\nPythonJava\nclass Solution:\n def longestCommonPrefix(self, s: List[str]) -&gt; str:\n     if not s:\n         return \"\"\n     s.sort()\n     n = len(s)\n     a = s[0]\n     b = s[n-1]\n     res = \"\"\n     for i in range(len(a)):\n         if i &lt; len(b) and a[i] == b[i]:\n             res += a[i]\n         else:\n             break\n     return res\n<\/code><\/pre>\n<p>\u4f5c\u8005\uff1apowcai<br \/>\n\u94fe\u63a5\uff1a<a href=\"https:\/\/leetcode-cn.com\/problems\/two-sum\/solution\/duo-chong-si-lu-qiu-jie-by-powcai-2\/\">https:\/\/leetcode-cn.com\/problems\/two-sum\/solution\/duo-chong-si-lu-qiu-jie-by-powcai-2\/<\/a><br \/>\n\u6765\u6e90\uff1a\u529b\u6263\uff08LeetCode\uff09<br \/>\n\u8457\u4f5c\u6743\u5f52\u4f5c\u8005\u6240\u6709\u3002\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u83b7\u5f97\u6388\u6743\uff0c\u975e\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002<\/p>\n<p>\u89e3\u6790<\/p>\n<pre><code>class Solution:\n def longestCommonPrefix(self, strs: List[str]) -&gt; str:\n     r = [len(set(c)) == 1 for c in zip(*strs)] + [0]\n     return strs[0][:r.index(0)] if strs else ''\n<\/code><\/pre>\n<p>\u5229\u7528\u597d zip \u548c set<br \/>\n\u3010\u7b2c\u4e00\u884c\u3011\u6bcf\u6b21\u90fd\u53d6\u5404\u4e2a\u5b57\u7b26\u4e32\u7684\u540c\u4e00\u5217\u5b57\u7b26\uff0c\u653e\u8fdb set\uff0cset \u4e2d\u4e0d\u4f1a\u50a8\u5b58\u91cd\u590d\u5143\u7d20\uff0c\u6240\u4ee5\u957f\u5ea6\u4e3a1\u4ee3\u8868\u5404\u4e2a\u5b57\u7b26\u90fd\u662f\u76f8\u540c\u7684\uff0c\u6b64\u65f6 == \u4f1a\u8ba9\u5b83\u53d8\u6210 True<br \/>\n\u3010\u7b2c\u4e8c\u884c\u3011index \u641c\u7d22\u7b2c\u4e00\u4e2a 0 \u7684\u4f4d\u7f6e\uff0c0 \u4e0e False \u5728\u503c\u4e0a\u662f\u7b49\u4ef7\u7684\uff0c\u76f8\u5f53\u4e8e\u641c\u7d22\u7b2c\u4e00\u4e2a False \u7684\u4f4d\u7f6e\u4e5f\u5c31\u662f\u516c\u5171\u524d\u7f00\u7684\u957f\u5ea6<br \/>\n\u7ec6\u8282\u8865\u5145<br \/>\nzip(*str) \u5c06 str \u4e2d\u6240\u6709\u5b57\u7b26\u4e32\u5e76\u5217\u5230\u8fed\u4ee3\u5668\u4e2d\uff0c\u9010\u6b21\u5e76\u5217\u8fd4\u56de str \u4e2d\u6240\u6709\u5b57\u7b26\u4e32\u7684\u7b2c 1\u30012\u30013\u3001\u2026\u2026 \u4e2a\u5b57\u7b26<br \/>\n\u7b2c\u4e00\u884c\u4ee3\u7801\u672b\u5c3e\u6dfb\u52a0\u4e86\u4e00\u4e2a [0] \u662f\u4e3a\u4e86\u9632\u6b62 index \u51fd\u6570\u641c\u7d22\u4e0d\u5230 0 \u65f6\u62a5\u9519<\/p>\n<p>\u4f5c\u8005\uff1aQQqun902025048<br \/>\n\u94fe\u63a5\uff1a<a href=\"https:\/\/leetcode-cn.com\/problems\/two-sum\/solution\/2-xing-python-by-knifezhu-2\/\">https:\/\/leetcode-cn.com\/problems\/two-sum\/solution\/2-xing-python-by-knifezhu-2\/<\/a><br \/>\n\u6765\u6e90\uff1a\u529b\u6263\uff08LeetCode\uff09<br \/>\n\u8457\u4f5c\u6743\u5f52\u4f5c\u8005\u6240\u6709\u3002\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u83b7\u5f97\u6388\u6743\uff0c\u975e\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002<\/p>\n<\/blockquote>\n<h2>3.\u5b57\u7b26\u4e32\u7684\u6392\u5217<\/h2>\n<p><strong>\u5173\u952e\u5b57\uff1a<\/strong><\/p>\n<p>\u7ed9\u5b9a\u4e24\u4e2a\u5b57\u7b26\u4e32 <strong>s1<\/strong> \u548c <strong>s2<\/strong>\uff0c\u5199\u4e00\u4e2a\u51fd\u6570\u6765\u5224\u65ad <strong>s2<\/strong> \u662f\u5426\u5305\u542b <strong>s1<\/strong> \u7684\u6392\u5217\u3002<\/p>\n<p>\u6362\u53e5\u8bdd\u8bf4\uff0c\u7b2c\u4e00\u4e2a\u5b57\u7b26\u4e32\u7684\u6392\u5217\u4e4b\u4e00\u662f\u7b2c\u4e8c\u4e2a\u5b57\u7b26\u4e32\u7684\u5b50\u4e32\u3002<\/p>\n<p><strong>\u793a\u4f8b1:<\/strong><\/p>\n<pre><code>\u8f93\u5165: s1 = &amp;quot;ab&amp;quot; s2 = &amp;quot;eidbaooo&amp;quot;\n\u8f93\u51fa: True\n\u89e3\u91ca: s2 \u5305\u542b s1 \u7684\u6392\u5217\u4e4b\u4e00 (&amp;quot;ba&amp;quot;).\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b2:<\/strong><\/p>\n<pre><code>\u8f93\u5165: s1= &amp;quot;ab&amp;quot; s2 = &amp;quot;eidboaoo&amp;quot;\n\u8f93\u51fa: False\n<\/code><\/pre>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ol>\n<li>\u8f93\u5165\u7684\u5b57\u7b26\u4e32\u53ea\u5305\u542b\u5c0f\u5199\u5b57\u6bcd<\/li>\n<li>\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u90fd\u5728 [1, 10,000] \u4e4b\u95f4<\/li>\n<\/ol>\n<h3>\u89e3\u7b54<\/h3>\n<pre><code class=\"language-python\">from collections import Counter\nclass Solution:\n    def checkInclusion(self, s1: str, s2: str) -&amp;gt; bool:\n        start = 0\n        end = 0\n        need_win = Counter(s1)\n        lookup = Counter()\n        count = 0\n        while end &amp;lt; len(s2):\n            if s2[end] not in need_win.keys():\n                lookup.clear()\n                count = 0\n                start = end + 1\n            else:\n                lookup[s2[end]] += 1\n                count += 1\n            end = end + 1\n            while count == len(s1):\n                while all(map(lambda x:lookup[x] &amp;gt;= need_win[x], need_win.keys())):\n                    if end - start == len(s1):\n                        return True\n                    break\n                lookup[s2[start]] -= 1\n                start = start + 1\n                count -= 1\n        return False\n<\/code><\/pre>\n<h2>4.\u5b57\u7b26\u4e32\u76f8\u4e58<\/h2>\n<p>\u7ed9\u5b9a\u4e24\u4e2a\u4ee5\u5b57\u7b26\u4e32\u5f62\u5f0f\u8868\u793a\u7684\u975e\u8d1f\u6574\u6570 <code>num1<\/code> \u548c <code>num2<\/code>\uff0c\u8fd4\u56de <code>num1<\/code> \u548c <code>num2<\/code> \u7684\u4e58\u79ef\uff0c\u5b83\u4eec\u7684\u4e58\u79ef\u4e5f\u8868\u793a\u4e3a<strong>\u5b57\u7b26\u4e32\u5f62\u5f0f<\/strong>\u3002<\/p>\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n<pre><code>\u8f93\u5165: num1 = &amp;quot;2&amp;quot;, num2 = &amp;quot;3&amp;quot;\n\u8f93\u51fa: &amp;quot;6&amp;quot;\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 2:<\/strong><\/p>\n<pre><code>\u8f93\u5165: num1 = &amp;quot;123&amp;quot;, num2 = &amp;quot;456&amp;quot;\n\u8f93\u51fa: &amp;quot;56088&amp;quot;\n<\/code><\/pre>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><\/p>\n<ol>\n<li><code>num1<\/code> \u548c <code>num2<\/code> \u7684\u957f\u5ea6\u5c0f\u4e8e110\u3002<\/li>\n<li><code>num1<\/code> \u548c <code>num2<\/code> \u53ea\u5305\u542b\u6570\u5b57 <code>0-9<\/code>\u3002<\/li>\n<li><code>num1<\/code> \u548c <code>num2<\/code> \u5747\u4e0d\u4ee5\u96f6\u5f00\u5934\uff0c\u9664\u975e\u662f\u6570\u5b57 0 \u672c\u8eab\u3002<\/li>\n<li><strong>\u4e0d\u80fd\u4f7f\u7528\u4efb\u4f55\u6807\u51c6\u5e93\u7684\u5927\u6570\u7c7b\u578b\uff08\u6bd4\u5982 BigInteger\uff09<\/strong>\u6216<strong>\u76f4\u63a5\u5c06\u8f93\u5165\u8f6c\u6362\u4e3a\u6574\u6570\u6765\u5904\u7406<\/strong>\u3002<\/li>\n<\/ol>\n<h3>\u89e3\u7b54<\/h3>\n<blockquote>\n<p>\u524d\u8a00<br \/>\n\u6ca1\u6709\u505a\u8fc7\u4e0a\u4e00\u9898\u7684\u670b\u53cb\u5efa\u8bae\u5148\u628a \u4e0a\u4e00\u9898 415 \u505a\u6389\uff0c<\/p>\n<p>\u672c\u9898\u662f\u4e0a\u4e00\u9898\u7684\u5347\u7ea7\u7248\uff0c\u533a\u522b\u5728\u4e8e 415 \u662f\u6c42\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u548c\uff0c\u800c43\u662f\u6c42\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u4e58\u79ef\u3002<\/p>\n<p>\u7ad6\u5f0f\u4e58\u6cd5<br \/>\n\u6211\u4eec\u5148\u6765\u7b80\u5355\u56de\u987e\u4e00\u4e0b\u5c0f\u5b66\u8001\u5e08\u6559\u8fc7\u7684\u5217\u7ad6\u5f0f\u6c42\u4e58\u6cd5\u7684\u8fc7\u7a0b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/kanghaov-img-1256185664.file.myqcloud.com\/2019\/07\/21\/5d33f90c24960.png\" alt=\"41cfd0b1d235e669eeb090ec5eec24560440e4d34ec27c021773b96f5fc6cfac-\u56fe\u72471.png\" \/><\/p>\n<p>\u5982\u4e0b\u56fe\u6240\u793a\uff0c\u4e24\u4e2a\u6570M\u548cN\u76f8\u4e58\u7684\u7ed3\u679c\u53ef\u4ee5\u7531 M \u4e58\u4e0a N \u7684\u6bcf\u4e00\u4f4d\u6570\u7684\u548c\u5f97\u5230\u3002<\/p>\n<p>\u4e3e\u4f8b 123 <em> 45 = 123 <\/em> 5 + 123 *40 = 615 + 4920 = 5535<\/p>\n<p>\u672c\u9898\u5206\u6790<br \/>\n\u5b57\u7b26\u4e32\u7684\u4e58\u6cd5\u4e5f\u53ef\u4ee5\u7531\u5217\u7ad6\u5f0f\u8ba1\u7b97\u7684\u65b9\u6cd5\u5f97\u5230\uff1a<\/p>\n<p>\u8ba9num1 \u4f9d\u6b21\u4e58\u4e0a num2 \u7684\u6bcf\u4e00\u4f4d\u7684\u548c<br \/>\n\u628a\u7b2c\u4e00\u6b65\u91cc\u5f97\u5230\u7684\u6240\u6709\u548c\u7d2f\u52a0\u5728\u4e00\u8d77\uff0c\u5c31\u53ef\u4ee5\u5f97\u5230 num1 * num2 \u7684\u7ed3\u679c\u3002<br \/>\n\u6709\u4e86\u4e0a\u9762\u7684\u5206\u6790\uff0c\u53ef\u4ee5\u5f97\u5230\u4e0b\u9762\u7684\u4e3b\u51fd\u6570\uff1a<\/p>\n<p>Python<\/p>\n<pre><code>class Solution(object):\ndef multiply(self, num1, num2):\n  \"\"\"\n  :type num1: str\n  :type num2: str\n  :rtype: str\n  \"\"\"\n  if num1 == \"0\" or num2 == \"0\": #\u5904\u7406\u7279\u6b8a\u60c5\u51b5\n      return \"0\"\n\n  l1, l2 = len(num1), len(num2)\n  if l1 &lt; l2:\n      num1, num2 = num2, num1 #\u4fdd\u969cnum1\u59cb\u7ec8\u6bd4num2\u957f\uff0c \u4e2a\u4eba\u4e60\u60ef\n      l1, l2 = l2, l1\n\n  num2 = num2[::-1] #\u6ce8\u610f\u8981\u5012\u8fc7\u6765\u4e58\uff0c\u65b9\u4fbf\u8fdb\u4f4d\n  res = \"0\"\n  for i, digit in enumerate(num2):\n      tmp = self.StringMultiplyDigit(num1, int(digit)) + \"0\" * i #\u8ba1\u7b97num1\u548cnum2\u7684\u5f53\u524d\u4f4d\u7684\u4e58\u79ef\n      res = self.StringPlusString(res, tmp) #\u8ba1\u7b97res\u548ctmp\u7684\u548c\n\n  return res\n<\/code><\/pre>\n<p>\u642d\u597d\u4e86\u9aa8\u67b6\u4e4b\u540e\uff0c\u63a5\u4e0b\u6765\u5c31\u662f\u5b9e\u73b0 \u8f85\u52a9\u51fd\u6570 \u7684\u529f\u80fd\uff0c \u8f85\u52a9\u51fd\u6570\u6709\u4e09\u4e2a\uff1a<\/p>\n<p>\u7b2c\u4e00\u4e2a\u51fd\u6570\u662f\u4e3a\u4e86\u8ba1\u7b97\u4e00\u4e2a\u5b57\u7b26\u4e32\u548c\u4e00\u4e2a\u6574\u6570\u7684\u4e58\u79ef\uff1a<\/p>\n<p>\u6838\u5fc3\u601d\u8def \u662f\uff1a<\/p>\n<p>\u5f00\u4e00\u4e2a\u6570\u7ec4 res, res[i] = int(string[i]) * n<br \/>\n\u4e58\u5b8c\u4e4b\u540e\u518d\u8c03\u7528\u7b2c\u4e8c\u4e2a\u8f85\u52a9\u51fd\u6570\u5904\u7406 res \u91cc\u7684\u8fdb\u4f4d<br \/>\n\u6700\u540e\u628a res \u8f6c\u6210\u5b57\u7b26\u4e32\u8fd4\u56de<br \/>\nPython<\/p>\n<pre><code>def StringMultiplyDigit(self,string, n):\n  #\u8fd9\u4e2a\u51fd\u6570\u7684\u529f\u80fd\u662f\uff1a\u8ba1\u7b97\u4e00\u4e2a\u5b57\u7b26\u4e32\u548c\u4e00\u4e2a\u6574\u6570\u7684\u4e58\u79ef\uff0c\u8fd4\u56de\u5b57\u7b26\u4e32\n  #\u4e3e\u4f8b\uff1a\u8f93\u5165\u4e3a \"123\", 3\uff0c \u8fd4\u56de\"369\"\n  s = string[::-1]\n  res = []\n  for i, char in enumerate(s):\n      num = int(char)\n      res.append(num * n)\n  res = self.CarrySolver(res)\n  res = res[::-1]\n  return \"\".join(str(x) for x in res)\n<\/code><\/pre>\n<p>\u7b2c\u4e8c\u4e2a\u51fd\u6570\u4e3a\u4e86\u5904\u7406\u4e58\u6cd5\u7ed3\u679c\u91cc\u7684\u8fdb\u4f4d\uff1a<\/p>\n<p>\u601d\u8def\uff1a<\/p>\n<p>\u628a\u6bcf\u4e00\u4f4d\u4e0a\u8d85\u8fc7 10 \u7684\u90e8\u5206\u90fd\u5411\u540e\u8fdb\u4f4d\uff0c<\/p>\n<p>\u6ce8\u610f\u5904\u7406\u6700\u540e\u4e00\u4f4d\u8fdb\u4f4d\u65f6\u6570\u7ec4\u9700\u8981 append \u4e00\u4e0b\uff0c\u5426\u5219\u4f1a \u4e0b\u6807\u8d8a\u754c \u3002<\/p>\n<p>Python<\/p>\n<pre><code>def CarrySolver(self, nums):\n  #\u8fd9\u4e2a\u51fd\u6570\u7684\u529f\u80fd\u662f\uff1a\u5c06\u8f93\u5165\u7684\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e00\u4f4d\u5904\u7406\u597d\u8fdb\u4f4d\n  #\u4e3e\u4f8b\uff1a\u8f93\u5165[15, 27, 12], \u8fd4\u56de[5, 8, 4, 1]\n  i = 0\n  while i &lt; len(nums):\n      if nums[i] &gt;= 10:\n          carrier = nums[i] \/\/ 10\n          if i == len(nums) - 1:\n              nums.append(carrier)\n          else:\n              nums[i + 1] += carrier\n          nums[i] %= 10\n      i += 1\n<\/code><\/pre>\n<p>\u7b2c\u4e09\u4e2a\u51fd\u6570\u4e3a\u4e86\u628a\u4e24\u4e2a\u5b57\u7b26\u4e32\u52a0\u5728\u4e00\u8d77\uff1a<\/p>\n<p>\u601d\u8def\uff1a\u8ddf\u7b2c\u4e00\u4e2a\u8f85\u52a9\u51fd\u6570\u7c7b\u4f3c\uff0c\u4f46\u66f4\u7b80\u5355\uff0c<\/p>\n<p>\u76f4\u63a5\u6bcf\u4e00\u4f4d\u52a0\u5728\u4e00\u8d77\u7136\u540e\u518d\u8c03\u7528\u7b2c\u4e8c\u4e2a\u8f85\u52a9\u51fd\u6570\u5904\u7406\u8fdb\u4f4d\u3002<\/p>\n<p>PS\uff1a\u7b2c415\u9898 \u5c31\u662f\u8981\u5199\u8fd9\u4e2a\u51fd\u6570<\/p>\n<p>Python<\/p>\n<pre><code>def StringPlusString(self, s1, s2):\n  #\u8fd9\u4e2a\u51fd\u6570\u7684\u529f\u80fd\u662f\uff1a\u8ba1\u7b97\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u548c\u3002\n  #\u4e3e\u4f8b\uff1a\u8f93\u5165\u4e3a\u201c123\u201d\uff0c \u201c456\u201d, \u8fd4\u56de\u4e3a\"579\"\n  #PS\uff1aLeetCode415\u9898\u5c31\u662f\u8981\u5199\u8fd9\u4e2a\u51fd\u6570\n  l1, l2 = len(s1), len(s2)\n  if l1 &lt; l2:\n      s1, s2 = s2, s1\n      l1, l2 = l2, l1\n  s1 = [int(x) for x in s1]\n  s2 = [int(x) for x in s2]\n  s1, s2 = s1[::-1], s2[::-1]\n  for i, digit in enumerate(s2):\n      s1[i] += s2[i]\n\n  s1 = self.CarrySolver(s1)\n  s1 = s1[::-1]\n  return \"\".join(str(x) for x in s1)\n<\/code><\/pre>\n<p>\u6240\u6709\u4ee3\u7801<br \/>\nPython<\/p>\n<pre><code>class Solution(object):\ndef multiply(self, num1, num2):\n  \"\"\"\n  :type num1: str\n  :type num2: str\n  :rtype: str\n  \"\"\"\n  if num1 == \"0\" or num2 == \"0\": #\u5904\u7406\u7279\u6b8a\u60c5\u51b5\n      return \"0\"\n\n  l1, l2 = len(num1), len(num2)\n  if l1 &lt; l2:\n      num1, num2 = num2, num1 #\u4fdd\u969cnum1\u59cb\u7ec8\u6bd4num2\u5927\n      l1, l2 = l2, l1\n\n  num2 = num2[::-1]\n  res = \"0\"\n  for i, digit in enumerate(num2):\n      tmp = self.StringMultiplyDigit(num1, int(digit)) + \"0\" * i #\u8ba1\u7b97num1\u548cnum2\u7684\u5f53\u524d\u4f4d\u7684\u4e58\u79ef\n      res = self.StringPlusString(res, tmp) #\u8ba1\u7b97res\u548ctmp\u7684\u548c\n\n  return res\n\ndef StringMultiplyDigit(self,string, n):\n  #\u8fd9\u4e2a\u51fd\u6570\u7684\u529f\u80fd\u662f\uff1a\u8ba1\u7b97\u4e00\u4e2a\u5b57\u7b26\u4e32\u548c\u4e00\u4e2a\u6574\u6570\u7684\u4e58\u79ef\uff0c\u8fd4\u56de\u5b57\u7b26\u4e32\n  #\u4e3e\u4f8b\uff1a\u8f93\u5165\u4e3a \"123\", 3\uff0c \u8fd4\u56de\"369\"\n  s = string[::-1]\n  res = []\n  for i, char in enumerate(s):\n      num = int(char)\n      res.append(num * n)\n  res = self.CarrySolver(res)\n  res = res[::-1]\n  return \"\".join(str(x) for x in res)\n\ndef CarrySolver(self, nums):\n  #\u8fd9\u4e2a\u51fd\u6570\u7684\u529f\u80fd\u662f\uff1a\u5c06\u8f93\u5165\u7684\u6570\u7ec4\u4e2d\u7684\u6bcf\u4e00\u4f4d\u5904\u7406\u597d\u8fdb\u4f4d\n  #\u4e3e\u4f8b\uff1a\u8f93\u5165[15, 27, 12], \u8fd4\u56de[5, 8, 4, 1]\n  i = 0\n  while i &lt; len(nums):\n      if nums[i] &gt;= 10:\n          carrier = nums[i] \/\/ 10\n          if i == len(nums) - 1:\n              nums.append(carrier)\n          else:\n              nums[i + 1] += carrier\n          nums[i] %= 10\n      i += 1\n\n  return nums\n\ndef StringPlusString(self, s1, s2):\n  #\u8fd9\u4e2a\u51fd\u6570\u7684\u529f\u80fd\u662f\uff1a\u8ba1\u7b97\u4e24\u4e2a\u5b57\u7b26\u4e32\u7684\u548c\u3002\n  #\u4e3e\u4f8b\uff1a\u8f93\u5165\u4e3a\u201c123\u201d\uff0c \u201c456\u201d, \u8fd4\u56de\u4e3a\"579\"\n  #PS\uff1aLeetCode415\u9898\u5c31\u662f\u8981\u5199\u8fd9\u4e2a\u51fd\u6570\n  l1, l2 = len(s1), len(s2)\n  if l1 &lt; l2:\n      s1, s2 = s2, s1\n      l1, l2 = l2, l1\n  s1 = [int(x) for x in s1]\n  s2 = [int(x) for x in s2]\n  s1, s2 = s1[::-1], s2[::-1]\n  for i, digit in enumerate(s2):\n      s1[i] += s2[i]\n\n  s1 = self.CarrySolver(s1)\n  s1 = s1[::-1]\n  return \"\".join(str(x) for x in s1)\n<\/code><\/pre>\n<p>\u590d\u6742\u5ea6\u5206\u6790<br \/>\n\u65f6\u95f4\u590d\u6742\u5ea6\u4e3a O(MN)O(MN)\uff0cM \u548c N \u5206\u522b\u4e3a num1\uff0cnum2 \u7684\u957f\u5ea6<\/p>\n<p>\u7a7a\u95f4\u590d\u6742\u5ea6\u4e3a O(M + N)O(M+N)<\/p>\n<p>\u4f5c\u8005\uff1aJiayangWu<br \/>\n\u94fe\u63a5\uff1a<a href=\"https:\/\/leetcode-cn.com\/problems\/two-sum\/solution\/python-zi-fu-chuan-bao-li-mo-ni-shu-shi-cheng-fa-j\/\">https:\/\/leetcode-cn.com\/problems\/two-sum\/solution\/python-zi-fu-chuan-bao-li-mo-ni-shu-shi-cheng-fa-j\/<\/a><br \/>\n\u6765\u6e90\uff1a\u529b\u6263\uff08LeetCode\uff09<br \/>\n\u8457\u4f5c\u6743\u5f52\u4f5c\u8005\u6240\u6709\u3002\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u8054\u7cfb\u4f5c\u8005\u83b7\u5f97\u6388\u6743\uff0c\u975e\u5546\u4e1a\u8f6c\u8f7d\u8bf7\u6ce8\u660e\u51fa\u5904\u3002<\/p>\n<\/blockquote>\n<pre><code class=\"language-python\">class Solution:\n    def str2int(self,s):\n        return ord(s)-ord(&amp;#039;0&amp;#039;)\n\n    def multiply(self, num1: str, num2: str) -&amp;gt; str:\n        a = num1[::-1]\n        b = num2[::-1]\n        result = 0\n\n        for i,x in enumerate(a):\n            temp_result = 0\n            for j,y in enumerate(b):\n                temp_result += self.str2int(x) * self.str2int(y) * 10**j\n            result += temp_result * 10**i\n        return str(result)\n<\/code><\/pre>\n<h2>5.\u7ffb\u8f6c\u5b57\u7b26\u4e32\u91cc\u7684\u5355\u8bcd<\/h2>\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u9010\u4e2a\u7ffb\u8f6c\u5b57\u7b26\u4e32\u4e2d\u7684\u6bcf\u4e2a\u5355\u8bcd\u3002<\/p>\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;the sky is blue&amp;quot;\n\u8f93\u51fa: &amp;quot;blue is sky the&amp;quot;\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;  hello world!  &amp;quot;\n\u8f93\u51fa: &amp;quot;world! hello&amp;quot;\n\u89e3\u91ca: \u8f93\u5165\u5b57\u7b26\u4e32\u53ef\u4ee5\u5728\u524d\u9762\u6216\u8005\u540e\u9762\u5305\u542b\u591a\u4f59\u7684\u7a7a\u683c\uff0c\u4f46\u662f\u53cd\u8f6c\u540e\u7684\u5b57\u7b26\u4e0d\u80fd\u5305\u62ec\u3002\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 3\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;a good   example&amp;quot;\n\u8f93\u51fa: &amp;quot;example good a&amp;quot;\n\u89e3\u91ca: \u5982\u679c\u4e24\u4e2a\u5355\u8bcd\u95f4\u6709\u591a\u4f59\u7684\u7a7a\u683c\uff0c\u5c06\u53cd\u8f6c\u540e\u5355\u8bcd\u95f4\u7684\u7a7a\u683c\u51cf\u5c11\u5230\u53ea\u542b\u4e00\u4e2a\u3002\n<\/code><\/pre>\n<p><strong>\u8bf4\u660e\uff1a<\/strong><\/p>\n<ul>\n<li>\u65e0\u7a7a\u683c\u5b57\u7b26\u6784\u6210\u4e00\u4e2a\u5355\u8bcd\u3002<\/li>\n<li>\u8f93\u5165\u5b57\u7b26\u4e32\u53ef\u4ee5\u5728\u524d\u9762\u6216\u8005\u540e\u9762\u5305\u542b\u591a\u4f59\u7684\u7a7a\u683c\uff0c\u4f46\u662f\u53cd\u8f6c\u540e\u7684\u5b57\u7b26\u4e0d\u80fd\u5305\u62ec\u3002<\/li>\n<li>\u5982\u679c\u4e24\u4e2a\u5355\u8bcd\u95f4\u6709\u591a\u4f59\u7684\u7a7a\u683c\uff0c\u5c06\u53cd\u8f6c\u540e\u5355\u8bcd\u95f4\u7684\u7a7a\u683c\u51cf\u5c11\u5230\u53ea\u542b\u4e00\u4e2a\u3002<\/li>\n<\/ul>\n<p><strong>\u8fdb\u9636\uff1a<\/strong><\/p>\n<p>\u8bf7\u9009\u7528 C \u8bed\u8a00\u7684\u7528\u6237\u5c1d\u8bd5\u4f7f\u7528 <em>O<\/em>(1) \u989d\u5916\u7a7a\u95f4\u590d\u6742\u5ea6\u7684\u539f\u5730\u89e3\u6cd5\u3002<\/p>\n<h3>\u89e3\u7b54<\/h3>\n<ul>\n<li>\u5148\u5904\u7406\u5b57\u7b26\u4e32\uff0c\u5c06\u9996\u5c3e\u7a7a\u683c\u90fd\u5220\u9664\uff1b<\/li>\n<\/ul>\n<ol>\n<li>\u5012\u5e8f\u904d\u5386\u5b57\u7b26\u4e32\uff0c\u5f53\u7b2c\u4e00\u6b21\u9047\u5230\u7a7a\u683c\u65f6\uff0c\u6dfb\u52a0<code>s[i + 1: j]<\/code>\uff08\u5373\u6dfb\u52a0\u4e00\u4e2a\u5b8c\u6574\u5355\u8bcd\uff09\uff1b<\/li>\n<li>\u7136\u540e\uff0c\u5c06\u76f4\u81f3\u4e0b\u4e00\u4e2a\u5355\u8bcd\u4e2d\u95f4\u7684\u7a7a\u683c\u8df3\u8fc7\uff0c\u5e76\u8bb0\u5f55\u4e0b\u4e00\u4e2a\u5355\u8bcd\u5c3e\u90e8<code>j<\/code>\uff1b<\/li>\n<li>\u7ee7\u7eed\u904d\u5386\uff0c\u76f4\u81f3\u4e0b\u4e00\u6b21\u9047\u5230\u7b2c\u4e00\u4e2a\u7a7a\u683c\uff0c\u56de\u5230<code>1.<\/code>\u6b65\u9aa4\uff1b<\/li>\n<\/ol>\n<ul>\n<li>\u7531\u4e8e\u9996\u90e8\u6ca1\u6709\u7a7a\u683c\uff0c\u56e0\u6b64\u6700\u540e\u9700\u8981\u5c06\u7b2c\u4e00\u4e2a\u5355\u8bcd\u52a0\u5165\uff0c\u518dreturn\u3002<\/li>\n<li>python\u53ef\u4e00\u884c\u5b9e\u73b0\u3002<\/li>\n<\/ul>\n<pre><code class=\"language-python\">class Solution:\n    def reverseWords(self, s: str) -&amp;gt; str:\n        s = s.strip()\n        res = &amp;#039;&amp;#039;\n        i ,j = len(s)-1,len(s)\n        while i &amp;gt; 0:\n            if s[i] == &amp;#039; &amp;#039;:\n                res += s[i+1:j]+&amp;#039; &amp;#039;\n                while s[i] == &amp;#039; &amp;#039;:\n                    i -= 1\n                j = i+1\n            i -= 1\n        return res+s[:j]\n<\/code><\/pre>\n<blockquote>\n<p>Python strip() \u65b9\u6cd5\u7528\u4e8e\u79fb\u9664\u5b57\u7b26\u4e32\u5934\u5c3e\u6307\u5b9a\u7684\u5b57\u7b26\uff08\u9ed8\u8ba4\u4e3a\u7a7a\u683c\u6216\u6362\u884c\u7b26\uff09\u6216\u5b57\u7b26\u5e8f\u5217\u3002<\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong>\u8be5\u65b9\u6cd5\u53ea\u80fd\u5220\u9664\u5f00\u5934\u6216\u662f\u7ed3\u5c3e\u7684\u5b57\u7b26\uff0c\u4e0d\u80fd\u5220\u9664\u4e2d\u95f4\u90e8\u5206\u7684\u5b57\u7b26\u3002<\/p>\n<\/blockquote>\n<h2>6.\u7b80\u5316\u8def\u5f84<\/h2>\n<p>\u4ee5 Unix \u98ce\u683c\u7ed9\u51fa\u4e00\u4e2a\u6587\u4ef6\u7684<strong>\u7edd\u5bf9\u8def\u5f84<\/strong>\uff0c\u4f60\u9700\u8981\u7b80\u5316\u5b83\u3002\u6216\u8005\u6362\u53e5\u8bdd\u8bf4\uff0c\u5c06\u5176\u8f6c\u6362\u4e3a\u89c4\u8303\u8def\u5f84\u3002<\/p>\n<p>\u5728 Unix \u98ce\u683c\u7684\u6587\u4ef6\u7cfb\u7edf\u4e2d\uff0c\u4e00\u4e2a\u70b9\uff08<code>.<\/code>\uff09\u8868\u793a\u5f53\u524d\u76ee\u5f55\u672c\u8eab\uff1b\u6b64\u5916\uff0c\u4e24\u4e2a\u70b9 \uff08<code>..<\/code>\uff09 \u8868\u793a\u5c06\u76ee\u5f55\u5207\u6362\u5230\u4e0a\u4e00\u7ea7\uff08\u6307\u5411\u7236\u76ee\u5f55\uff09\uff1b\u4e24\u8005\u90fd\u53ef\u4ee5\u662f\u590d\u6742\u76f8\u5bf9\u8def\u5f84\u7684\u7ec4\u6210\u90e8\u5206\u3002\u66f4\u591a\u4fe1\u606f\u8bf7\u53c2\u9605\uff1a<a href=\"https:\/\/blog.csdn.net\/u011327334\/article\/details\/50355600\">Linux \/ Unix\u4e2d\u7684\u7edd\u5bf9\u8def\u5f84 vs \u76f8\u5bf9\u8def\u5f84<\/a><\/p>\n<p>\u8bf7\u6ce8\u610f\uff0c\u8fd4\u56de\u7684\u89c4\u8303\u8def\u5f84\u5fc5\u987b\u59cb\u7ec8\u4ee5\u659c\u6760 <code>\/<\/code> \u5f00\u5934\uff0c\u5e76\u4e14\u4e24\u4e2a\u76ee\u5f55\u540d\u4e4b\u95f4\u5fc5\u987b\u53ea\u6709\u4e00\u4e2a\u659c\u6760 <code>\/<\/code>\u3002\u6700\u540e\u4e00\u4e2a\u76ee\u5f55\u540d\uff08\u5982\u679c\u5b58\u5728\uff09<strong>\u4e0d\u80fd<\/strong>\u4ee5 <code>\/<\/code> \u7ed3\u5c3e\u3002\u6b64\u5916\uff0c\u89c4\u8303\u8def\u5f84\u5fc5\u987b\u662f\u8868\u793a\u7edd\u5bf9\u8def\u5f84\u7684<strong>\u6700\u77ed<\/strong>\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165\uff1a&amp;quot;\/home\/&amp;quot;\n\u8f93\u51fa\uff1a&amp;quot;\/home&amp;quot;\n\u89e3\u91ca\uff1a\u6ce8\u610f\uff0c\u6700\u540e\u4e00\u4e2a\u76ee\u5f55\u540d\u540e\u9762\u6ca1\u6709\u659c\u6760\u3002\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165\uff1a&amp;quot;\/..\/&amp;quot;\n\u8f93\u51fa\uff1a&amp;quot;\/&amp;quot;\n\u89e3\u91ca\uff1a\u4ece\u6839\u76ee\u5f55\u5411\u4e0a\u4e00\u7ea7\u662f\u4e0d\u53ef\u884c\u7684\uff0c\u56e0\u4e3a\u6839\u662f\u4f60\u53ef\u4ee5\u5230\u8fbe\u7684\u6700\u9ad8\u7ea7\u3002\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 3\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165\uff1a&amp;quot;\/home\/\/foo\/&amp;quot;\n\u8f93\u51fa\uff1a&amp;quot;\/home\/foo&amp;quot;\n\u89e3\u91ca\uff1a\u5728\u89c4\u8303\u8def\u5f84\u4e2d\uff0c\u591a\u4e2a\u8fde\u7eed\u659c\u6760\u9700\u8981\u7528\u4e00\u4e2a\u659c\u6760\u66ff\u6362\u3002\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 4\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165\uff1a&amp;quot;\/a\/.\/b\/..\/..\/c\/&amp;quot;\n\u8f93\u51fa\uff1a&amp;quot;\/c&amp;quot;\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 5\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165\uff1a&amp;quot;\/a\/..\/..\/b\/..\/c\/\/.\/\/&amp;quot;\n\u8f93\u51fa\uff1a&amp;quot;\/c&amp;quot;\n<\/code><\/pre>\n<p><strong>\u793a\u4f8b 6\uff1a<\/strong><\/p>\n<pre><code>\u8f93\u5165\uff1a&amp;quot;\/a\/\/b\/\/\/\/c\/d\/\/.\/.\/\/..&amp;quot;\n\u8f93\u51fa\uff1a&amp;quot;\/a\/b\/c&amp;quot;\n<\/code><\/pre>\n<h3>\u89e3\u7b54<\/h3>\n<p>\u6808\u89e3\u51b3,\u628a\u5f53\u524d\u76ee\u5f55\u538b\u5165\u6808\u4e2d,\u9047\u5230<code>..<\/code>\u5f39\u51fa\u6808\u9876,\u6700\u540e\u8fd4\u56de\u6808\u4e2d\u5143\u7d20\u3002<\/p>\n<pre><code class=\"language-python\">class Solution:\n    def simplifyPath(self, path: str) -&amp;gt; str:\n        stack = []\n        path = path.split(&amp;#039;\/&amp;#039;)\n\n        for item in path:\n            if item == &amp;#039;..&amp;#039;:\n                if stack:\n                    stack.pop()\n            elif item and item != &amp;#039;.&amp;#039;:\n                stack.append(item)\n        return &amp;#039;\/&amp;#039;+&amp;#039;\/&amp;#039;.join(stack)\n<\/code><\/pre>\n<h2>7.\u590d\u539fIP\u5730\u5740<\/h2>\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u53ea\u5305\u542b\u6570\u5b57\u7684\u5b57\u7b26\u4e32\uff0c\u590d\u539f\u5b83\u5e76\u8fd4\u56de\u6240\u6709\u53ef\u80fd\u7684 IP \u5730\u5740\u683c\u5f0f\u3002<\/p>\n<p><strong>\u793a\u4f8b:<\/strong><\/p>\n<pre><code>\u8f93\u5165: &amp;quot;25525511135&amp;quot;\n\u8f93\u51fa: [&amp;quot;255.255.11.135&amp;quot;, &amp;quot;255.255.111.35&amp;quot;]\n<\/code><\/pre>\n<h3>\u89e3\u7b54<\/h3>\n<p>\u6211\u4eec\u8981\u77e5\u9053IP\u7684\u683c\u5f0f,\u6bcf\u4f4d\u662f\u57280~255\u4e4b\u95f4,<\/p>\n<p>\u6ce8\u610f: \u4e0d\u80fd\u51fa\u73b0\u4ee50\u5f00\u5934\u7684\u4e24\u4f4d\u4ee5\u4e0a\u6570\u5b57,\u6bd4\u5982012,08&#8230;<\/p>\n<p>\u601d\u8def\u4e00:\u66b4\u529b\u6cd5<\/p>\n<p>\u6211\u4eec\u628a\u6240\u6709\u51fa\u73b0\u53ef\u80fd\u90fd\u5217\u4e3e\u51fa\u6765,\u770b\u662f\u5426\u6ee1\u8db3\u6761\u4ef6.<\/p>\n<pre><code class=\"language-python\">class Solution:\n    def restoreIpAddresses(self, s: str) -&amp;gt; List[str]:\n        n = len(s)\n        res = []\n\n        def helper(tmp):\n            if not tmp or (tmp[0] == &amp;#039;0&amp;#039; and len(tmp) &amp;gt; 1) or int(tmp) &amp;gt; 255:\n                return False\n            return True\n\n        for i in range(3):\n            for j in range(i+1,i+4):\n                for k in range(j+1,j+4):\n                    if i &amp;lt; n and j &amp;lt; n and k &amp;lt; n:\n                        tmp1 = s[:i+1]\n                        tmp2 = s[i+1:j+1]\n                        tmp3 = s[j+1:k+1]\n                        tmp4 = s[k+1:]\n\n                        if  all(map(helper,[tmp1,tmp2,tmp3,tmp4])):\n                            res.append(tmp1+&amp;#039;.&amp;#039;+tmp2+&amp;#039;.&amp;#039;+tmp3+&amp;#039;.&amp;#039;+tmp4)\n\n        return res\n<\/code><\/pre>\n<p>\u601d\u8def\u4e8c:\u56de\u6eaf\u7b97\u6cd5<\/p>\n<pre><code class=\"language-python\">class Solution:\n    def restoreIpAddresses(self, s: str) -&amp;gt; List[str]:\n        res = []\n        n = len(s)\n\n        def backtrack(i, tmp, flag):\n            if i == n and flag == 0:\n                res.append(tmp[:-1])\n                return\n            if flag &amp;lt; 0:\n                return\n            for j in range(i, i + 3):\n                if j &amp;lt; n:\n                    if i == j and s[j] == &amp;quot;0&amp;quot;:\n                        backtrack(j + 1, tmp + s[j] + &amp;quot;.&amp;quot;, flag - 1)\n                        break\n                    if 0 &amp;lt; int(s[i:j + 1]) &amp;lt;= 255:\n                        backtrack(j + 1, tmp + s[i:j + 1] + &amp;quot;.&amp;quot;, flag - 1)\n\n        backtrack(0, &amp;quot;&amp;quot;, 4)\n        return res\n<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>[TOC] 1.\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32 \u5173\u952e\u5b57\uff1a\u54c8\u5e0c\u8868\u3001\u53cc\u6307\u9488\u3001\u5b57\u7b26\u4e32\u3001Sliding Window \u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684 \u6700\u957f\u5b50\u4e32 \u7684\u957f\u5ea6\u3002 \u793a\u4f8b 1: \u8f93\u5165: &amp;quot;abcabcbb&amp;quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;abc&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002 \u793a\u4f8b 2: \u8f93\u5165: &amp;quot;bbbbb&amp;quot; \u8f93\u51fa: 1 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;b&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 1\u3002 \u793a\u4f8b 3: \u8f93\u5165: &amp;quot;pwwkew&amp;quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;wke&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002 \u8bf7\u6ce8\u610f\uff0c\u4f60\u7684\u7b54\u6848\u5fc5\u987b\u662f \u5b50\u4e32 \u7684\u957f\u5ea6\uff0c&amp;quot;pwke&amp;quot; \u662f\u4e00\u4e2a\u5b50\u5e8f\u5217\uff0c\u4e0d\u662f\u5b50\u4e32\u3002 \u89e3\u7b54 \u4f20\u7edf\u7684\u89e3\u6cd5\u662f\u66b4\u529b\u7834\u89e3\uff0c\u5148\u7f57\u5217\u51fa\u8fd9\u4e2a\u5b57\u7b26\u4e32\u7684\u6240\u6709\u5b50\u4e32\u7136\u540e\u4f9d\u6b21\u5224\u65ad\u8fd9\u4e9b\u5b50\u4e32\u4e2d\u662f\u5426\u542b\u6709\u76f8\u540c\u5b57\u7b26\uff0c\u8fd9\u6837\u505a\u592a\u6162\u4e86 \u4e0b\u9762\u4ecb\u7ecd\u6ed1\u52a8\u7a97\u53e3\u6c42\u6700\u5927\u5b50\u4e32\uff1a \u201c\u6ed1\u52a8\u7a97\u53e3\u201d\u8fd9\u4e2a\u6982\u5ff5\u5728\u8ba1\u7b97\u673a\u7b97\u6cd5\u4e2d\u975e\u5e38\u5e38\u89c1\u3002\u8be5\u7b97\u6cd5\u53ef\u4ee5\u628a\u5d4c\u5957\u7684\u5faa\u73af\u8f6c\u5316\u4e3a\u5355\u5faa\u73af\u4ece\u800c\u964d\u4f4e\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u5b83\u5728\u5f88\u591a\u4e0d\u540c\u7684\u9886\u57df\u90fd\u6709\u5e94\u7528\uff1a 1.TCP\u534f\u8bae\u7684\u6ed1\u52a8\u7a97\u53e3\u8fdb\u884c\u6d41\u91cf\u63a7\u5236 2.NLP\uff08\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff09\u4e2d\u7684 N-gram 3.\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u7269\u4f53\u8bc6\u522b \u4e0b\u9762\u5f00\u59cb\u4f7f\u7528\u6ed1\u52a8\u7a97\u53e3\u6c42\u89e3\u6700\u5927\u5b50\u4e32\uff0c\u4f8b\u5982\u9898\u76ee\u4e2d\u7684\u2018abcabcbb\u2019\u4f8b\u5b50\uff1a \u5f00\u59cb\u7684\u65f6\u5019\uff0cbegin\u548cend\u90fd\u6307\u54110\u7684\u4f4d\u7f6e\u5373\u2018a\u2019\uff0c\u7136\u540eend\u4e0d\u65ad\u540e\u79fb\uff08\u7a97\u53e3\u53d8\u5bbd\uff09\uff0c\u5f53\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\uff08\u9047\u89c1\u91cd\u590d\u5b57\u7b26\uff09\u5c31\u5f97\u5230\u4e00\u4e2a\u5b50\u4e32\uff0c\u5176\u957f\u5ea6\u5c31\u662fend\u548cbegin\u4f4d\u7f6e\u7684\u5dee\u3002 \u5982\u4f55\u5224\u65ad\u662f\u5426\u9047\u5230\u4e86\u91cd\u590d\u5b57\u7b26\u2018a\u2019\u5462\uff1f\u9700\u8981\u4e00\u4e2a\u5b57\u5178\u4f5c\u4e3a\u8f85\u52a9\u6570\u636e\u7ed3\u6784\uff0c\u628aend\u4ece\u5934\u5f00\u59cb\u9047\u5230\u7684\u6bcf\u4e2a\u5b57\u7b26\u53ca\u5176\u7d22\u5f15\u4f4d\u7f6e\u90fd\u653e\u5230\u5b57\u5178\u91cc\u9762\uff0cend\u6bcf\u6b21\u79fb\u52a8\u5230\u65b0\u5b57\u7b26\u5c31\u67e5\u4e00\u4e0b\u5b57\u5178\u5373\u53ef\u3002 \u901a\u8fc7\u5b57\u5178\uff0c\u6211\u4eec\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\u5c31\u53ef\u4ee5\u627e\u5230\u5b58\u5728\u5b57\u5178\u91cc\u9762\u7684\u7b2c\u4e00\u4e2a\u2018a\u2019\u7684\u4f4d\u7f6e\u3002\u4e3a\u4e86\u7ee7\u7eed\u5bfb\u627e\u65e0\u91cd\u590d\u5b50\u4e32\uff0cbegin\u5c31\u8981\u6307\u5411\u7b2c\u4e00\u4e2a\u2018a\u2019\u540e\u9762\u4e00\u4e2a\u7684\u4f4d\u7f6e\u5373\u2018b\u2019\u3002\u7136\u540eend\u7ee7\u7eed\u540e\u79fb\u5230\u2018b\u2019\uff0c\u6709\u53d1\u73b0\u5b83\u4e0e\u524d\u9762\u7684\u2018b\u2019\u91cd\u590d\uff0c\u8ba1\u7b97\u5b50\u4e32\u957f\u5ea6\u8d4b\u503c\u7ed9\u6700\u5927\u957f\u5ea6\uff08\u9700\u8981\u6bd4\u8f83\uff09\uff0c\u540c\u65f6begin\u8981\u79fb\u52a8\u7b2c\u4e00\u4e2a\u2018b\u2019\u540e\u9762\u7684\u4f4d\u7f6e\u5373\u2018c\u2019\u3002 \u8fd9\u6837\u4f9d\u6b21\u79fb\u52a8end\u5230\u5b57\u7b26\u4e32\u672b\u5c3e\u5c31\u53ef\u4ee5\u627e\u5230\u6700\u957f\u7684\u5b50\u4e32\uff0c\u201c\u5b50\u4e32\u7a97\u53e3\u201d\u4e5f\u5c31\u4ece\u5934\u79fb\u5230\u4e86\u672b\u5c3e\u3002\u800c\u53ea\u9700\u8981end\u4ece\u5934\u5230\u5c3e\u7684\u4e00\u6b21\u5faa\u73af\u5373\u53ef\u3002 class [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":237,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[19,2],"tags":[24,10,43,42,23],"class_list":["post-233","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-algorithm","category-py","tag-leetcode","tag-python","tag-43","tag-42","tag-23"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32 - Nemo<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/nemo.cool\/233.html\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32 - Nemo\" \/>\n<meta property=\"og:description\" content=\"[TOC] 1.\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32 \u5173\u952e\u5b57\uff1a\u54c8\u5e0c\u8868\u3001\u53cc\u6307\u9488\u3001\u5b57\u7b26\u4e32\u3001Sliding Window \u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684 \u6700\u957f\u5b50\u4e32 \u7684\u957f\u5ea6\u3002 \u793a\u4f8b 1: \u8f93\u5165: &amp;quot;abcabcbb&amp;quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;abc&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002 \u793a\u4f8b 2: \u8f93\u5165: &amp;quot;bbbbb&amp;quot; \u8f93\u51fa: 1 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;b&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 1\u3002 \u793a\u4f8b 3: \u8f93\u5165: &amp;quot;pwwkew&amp;quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;wke&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002 \u8bf7\u6ce8\u610f\uff0c\u4f60\u7684\u7b54\u6848\u5fc5\u987b\u662f \u5b50\u4e32 \u7684\u957f\u5ea6\uff0c&amp;quot;pwke&amp;quot; \u662f\u4e00\u4e2a\u5b50\u5e8f\u5217\uff0c\u4e0d\u662f\u5b50\u4e32\u3002 \u89e3\u7b54 \u4f20\u7edf\u7684\u89e3\u6cd5\u662f\u66b4\u529b\u7834\u89e3\uff0c\u5148\u7f57\u5217\u51fa\u8fd9\u4e2a\u5b57\u7b26\u4e32\u7684\u6240\u6709\u5b50\u4e32\u7136\u540e\u4f9d\u6b21\u5224\u65ad\u8fd9\u4e9b\u5b50\u4e32\u4e2d\u662f\u5426\u542b\u6709\u76f8\u540c\u5b57\u7b26\uff0c\u8fd9\u6837\u505a\u592a\u6162\u4e86 \u4e0b\u9762\u4ecb\u7ecd\u6ed1\u52a8\u7a97\u53e3\u6c42\u6700\u5927\u5b50\u4e32\uff1a \u201c\u6ed1\u52a8\u7a97\u53e3\u201d\u8fd9\u4e2a\u6982\u5ff5\u5728\u8ba1\u7b97\u673a\u7b97\u6cd5\u4e2d\u975e\u5e38\u5e38\u89c1\u3002\u8be5\u7b97\u6cd5\u53ef\u4ee5\u628a\u5d4c\u5957\u7684\u5faa\u73af\u8f6c\u5316\u4e3a\u5355\u5faa\u73af\u4ece\u800c\u964d\u4f4e\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u5b83\u5728\u5f88\u591a\u4e0d\u540c\u7684\u9886\u57df\u90fd\u6709\u5e94\u7528\uff1a 1.TCP\u534f\u8bae\u7684\u6ed1\u52a8\u7a97\u53e3\u8fdb\u884c\u6d41\u91cf\u63a7\u5236 2.NLP\uff08\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff09\u4e2d\u7684 N-gram 3.\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u7269\u4f53\u8bc6\u522b \u4e0b\u9762\u5f00\u59cb\u4f7f\u7528\u6ed1\u52a8\u7a97\u53e3\u6c42\u89e3\u6700\u5927\u5b50\u4e32\uff0c\u4f8b\u5982\u9898\u76ee\u4e2d\u7684\u2018abcabcbb\u2019\u4f8b\u5b50\uff1a \u5f00\u59cb\u7684\u65f6\u5019\uff0cbegin\u548cend\u90fd\u6307\u54110\u7684\u4f4d\u7f6e\u5373\u2018a\u2019\uff0c\u7136\u540eend\u4e0d\u65ad\u540e\u79fb\uff08\u7a97\u53e3\u53d8\u5bbd\uff09\uff0c\u5f53\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\uff08\u9047\u89c1\u91cd\u590d\u5b57\u7b26\uff09\u5c31\u5f97\u5230\u4e00\u4e2a\u5b50\u4e32\uff0c\u5176\u957f\u5ea6\u5c31\u662fend\u548cbegin\u4f4d\u7f6e\u7684\u5dee\u3002 \u5982\u4f55\u5224\u65ad\u662f\u5426\u9047\u5230\u4e86\u91cd\u590d\u5b57\u7b26\u2018a\u2019\u5462\uff1f\u9700\u8981\u4e00\u4e2a\u5b57\u5178\u4f5c\u4e3a\u8f85\u52a9\u6570\u636e\u7ed3\u6784\uff0c\u628aend\u4ece\u5934\u5f00\u59cb\u9047\u5230\u7684\u6bcf\u4e2a\u5b57\u7b26\u53ca\u5176\u7d22\u5f15\u4f4d\u7f6e\u90fd\u653e\u5230\u5b57\u5178\u91cc\u9762\uff0cend\u6bcf\u6b21\u79fb\u52a8\u5230\u65b0\u5b57\u7b26\u5c31\u67e5\u4e00\u4e0b\u5b57\u5178\u5373\u53ef\u3002 \u901a\u8fc7\u5b57\u5178\uff0c\u6211\u4eec\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\u5c31\u53ef\u4ee5\u627e\u5230\u5b58\u5728\u5b57\u5178\u91cc\u9762\u7684\u7b2c\u4e00\u4e2a\u2018a\u2019\u7684\u4f4d\u7f6e\u3002\u4e3a\u4e86\u7ee7\u7eed\u5bfb\u627e\u65e0\u91cd\u590d\u5b50\u4e32\uff0cbegin\u5c31\u8981\u6307\u5411\u7b2c\u4e00\u4e2a\u2018a\u2019\u540e\u9762\u4e00\u4e2a\u7684\u4f4d\u7f6e\u5373\u2018b\u2019\u3002\u7136\u540eend\u7ee7\u7eed\u540e\u79fb\u5230\u2018b\u2019\uff0c\u6709\u53d1\u73b0\u5b83\u4e0e\u524d\u9762\u7684\u2018b\u2019\u91cd\u590d\uff0c\u8ba1\u7b97\u5b50\u4e32\u957f\u5ea6\u8d4b\u503c\u7ed9\u6700\u5927\u957f\u5ea6\uff08\u9700\u8981\u6bd4\u8f83\uff09\uff0c\u540c\u65f6begin\u8981\u79fb\u52a8\u7b2c\u4e00\u4e2a\u2018b\u2019\u540e\u9762\u7684\u4f4d\u7f6e\u5373\u2018c\u2019\u3002 \u8fd9\u6837\u4f9d\u6b21\u79fb\u52a8end\u5230\u5b57\u7b26\u4e32\u672b\u5c3e\u5c31\u53ef\u4ee5\u627e\u5230\u6700\u957f\u7684\u5b50\u4e32\uff0c\u201c\u5b50\u4e32\u7a97\u53e3\u201d\u4e5f\u5c31\u4ece\u5934\u79fb\u5230\u4e86\u672b\u5c3e\u3002\u800c\u53ea\u9700\u8981end\u4ece\u5934\u5230\u5c3e\u7684\u4e00\u6b21\u5faa\u73af\u5373\u53ef\u3002 class [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/nemo.cool\/233.html\" \/>\n<meta property=\"og:site_name\" content=\"Nemo\" \/>\n<meta property=\"article:published_time\" content=\"2019-07-21T08:46:59+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2019-08-08T11:06:21+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/nemo.cool\/wp-content\/uploads\/2019\/07\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"750\" \/>\n\t<meta property=\"og:image:height\" content=\"452\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Nemo\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Nemo\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"8 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html\"},\"author\":{\"name\":\"Nemo\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/#\\\/schema\\\/person\\\/698f803ee811e2b140a90f5d5de913d2\"},\"headline\":\"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32\",\"datePublished\":\"2019-07-21T08:46:59+00:00\",\"dateModified\":\"2019-08-08T11:06:21+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html\"},\"wordCount\":131,\"commentCount\":1,\"publisher\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/#\\\/schema\\\/person\\\/698f803ee811e2b140a90f5d5de913d2\"},\"image\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg\",\"keywords\":[\"leetcode\",\"python\",\"\u5b57\u7b26\u4e32\u7c7b\",\"\u5b57\u8282\u8df3\u52a8\",\"\u7b97\u6cd5\"],\"articleSection\":[\"Algorithm Notes\",\"Python\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/nemo.cool\\\/233.html#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html\",\"url\":\"https:\\\/\\\/nemo.cool\\\/233.html\",\"name\":\"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32 - Nemo\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg\",\"datePublished\":\"2019-07-21T08:46:59+00:00\",\"dateModified\":\"2019-08-08T11:06:21+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/nemo.cool\\\/233.html\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#primaryimage\",\"url\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg\",\"contentUrl\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2019\\\/07\\\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg\",\"width\":750,\"height\":452},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/233.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\\\/\\\/nemo.cool\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/#website\",\"url\":\"https:\\\/\\\/nemo.cool\\\/\",\"name\":\"Nemo\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/#\\\/schema\\\/person\\\/698f803ee811e2b140a90f5d5de913d2\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/nemo.cool\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/nemo.cool\\\/#\\\/schema\\\/person\\\/698f803ee811e2b140a90f5d5de913d2\",\"name\":\"Nemo\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg\",\"url\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg\",\"contentUrl\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg\",\"caption\":\"Nemo\"},\"logo\":{\"@id\":\"https:\\\/\\\/nemo.cool\\\/wp-content\\\/uploads\\\/2024\\\/01\\\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg\"},\"sameAs\":[\"https:\\\/\\\/nemo.cool\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32 - Nemo","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/nemo.cool\/233.html","og_locale":"en_US","og_type":"article","og_title":"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32 - Nemo","og_description":"[TOC] 1.\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32 \u5173\u952e\u5b57\uff1a\u54c8\u5e0c\u8868\u3001\u53cc\u6307\u9488\u3001\u5b57\u7b26\u4e32\u3001Sliding Window \u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684 \u6700\u957f\u5b50\u4e32 \u7684\u957f\u5ea6\u3002 \u793a\u4f8b 1: \u8f93\u5165: &amp;quot;abcabcbb&amp;quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;abc&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002 \u793a\u4f8b 2: \u8f93\u5165: &amp;quot;bbbbb&amp;quot; \u8f93\u51fa: 1 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;b&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 1\u3002 \u793a\u4f8b 3: \u8f93\u5165: &amp;quot;pwwkew&amp;quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &amp;quot;wke&amp;quot;\uff0c\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002 \u8bf7\u6ce8\u610f\uff0c\u4f60\u7684\u7b54\u6848\u5fc5\u987b\u662f \u5b50\u4e32 \u7684\u957f\u5ea6\uff0c&amp;quot;pwke&amp;quot; \u662f\u4e00\u4e2a\u5b50\u5e8f\u5217\uff0c\u4e0d\u662f\u5b50\u4e32\u3002 \u89e3\u7b54 \u4f20\u7edf\u7684\u89e3\u6cd5\u662f\u66b4\u529b\u7834\u89e3\uff0c\u5148\u7f57\u5217\u51fa\u8fd9\u4e2a\u5b57\u7b26\u4e32\u7684\u6240\u6709\u5b50\u4e32\u7136\u540e\u4f9d\u6b21\u5224\u65ad\u8fd9\u4e9b\u5b50\u4e32\u4e2d\u662f\u5426\u542b\u6709\u76f8\u540c\u5b57\u7b26\uff0c\u8fd9\u6837\u505a\u592a\u6162\u4e86 \u4e0b\u9762\u4ecb\u7ecd\u6ed1\u52a8\u7a97\u53e3\u6c42\u6700\u5927\u5b50\u4e32\uff1a \u201c\u6ed1\u52a8\u7a97\u53e3\u201d\u8fd9\u4e2a\u6982\u5ff5\u5728\u8ba1\u7b97\u673a\u7b97\u6cd5\u4e2d\u975e\u5e38\u5e38\u89c1\u3002\u8be5\u7b97\u6cd5\u53ef\u4ee5\u628a\u5d4c\u5957\u7684\u5faa\u73af\u8f6c\u5316\u4e3a\u5355\u5faa\u73af\u4ece\u800c\u964d\u4f4e\u65f6\u95f4\u590d\u6742\u5ea6\u3002\u5b83\u5728\u5f88\u591a\u4e0d\u540c\u7684\u9886\u57df\u90fd\u6709\u5e94\u7528\uff1a 1.TCP\u534f\u8bae\u7684\u6ed1\u52a8\u7a97\u53e3\u8fdb\u884c\u6d41\u91cf\u63a7\u5236 2.NLP\uff08\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff09\u4e2d\u7684 N-gram 3.\u56fe\u50cf\u5904\u7406\u4e2d\u7684\u7269\u4f53\u8bc6\u522b \u4e0b\u9762\u5f00\u59cb\u4f7f\u7528\u6ed1\u52a8\u7a97\u53e3\u6c42\u89e3\u6700\u5927\u5b50\u4e32\uff0c\u4f8b\u5982\u9898\u76ee\u4e2d\u7684\u2018abcabcbb\u2019\u4f8b\u5b50\uff1a \u5f00\u59cb\u7684\u65f6\u5019\uff0cbegin\u548cend\u90fd\u6307\u54110\u7684\u4f4d\u7f6e\u5373\u2018a\u2019\uff0c\u7136\u540eend\u4e0d\u65ad\u540e\u79fb\uff08\u7a97\u53e3\u53d8\u5bbd\uff09\uff0c\u5f53\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\uff08\u9047\u89c1\u91cd\u590d\u5b57\u7b26\uff09\u5c31\u5f97\u5230\u4e00\u4e2a\u5b50\u4e32\uff0c\u5176\u957f\u5ea6\u5c31\u662fend\u548cbegin\u4f4d\u7f6e\u7684\u5dee\u3002 \u5982\u4f55\u5224\u65ad\u662f\u5426\u9047\u5230\u4e86\u91cd\u590d\u5b57\u7b26\u2018a\u2019\u5462\uff1f\u9700\u8981\u4e00\u4e2a\u5b57\u5178\u4f5c\u4e3a\u8f85\u52a9\u6570\u636e\u7ed3\u6784\uff0c\u628aend\u4ece\u5934\u5f00\u59cb\u9047\u5230\u7684\u6bcf\u4e2a\u5b57\u7b26\u53ca\u5176\u7d22\u5f15\u4f4d\u7f6e\u90fd\u653e\u5230\u5b57\u5178\u91cc\u9762\uff0cend\u6bcf\u6b21\u79fb\u52a8\u5230\u65b0\u5b57\u7b26\u5c31\u67e5\u4e00\u4e0b\u5b57\u5178\u5373\u53ef\u3002 \u901a\u8fc7\u5b57\u5178\uff0c\u6211\u4eec\u9047\u5230\u7b2c\u4e8c\u4e2a\u2018a\u2019\u65f6\u5c31\u53ef\u4ee5\u627e\u5230\u5b58\u5728\u5b57\u5178\u91cc\u9762\u7684\u7b2c\u4e00\u4e2a\u2018a\u2019\u7684\u4f4d\u7f6e\u3002\u4e3a\u4e86\u7ee7\u7eed\u5bfb\u627e\u65e0\u91cd\u590d\u5b50\u4e32\uff0cbegin\u5c31\u8981\u6307\u5411\u7b2c\u4e00\u4e2a\u2018a\u2019\u540e\u9762\u4e00\u4e2a\u7684\u4f4d\u7f6e\u5373\u2018b\u2019\u3002\u7136\u540eend\u7ee7\u7eed\u540e\u79fb\u5230\u2018b\u2019\uff0c\u6709\u53d1\u73b0\u5b83\u4e0e\u524d\u9762\u7684\u2018b\u2019\u91cd\u590d\uff0c\u8ba1\u7b97\u5b50\u4e32\u957f\u5ea6\u8d4b\u503c\u7ed9\u6700\u5927\u957f\u5ea6\uff08\u9700\u8981\u6bd4\u8f83\uff09\uff0c\u540c\u65f6begin\u8981\u79fb\u52a8\u7b2c\u4e00\u4e2a\u2018b\u2019\u540e\u9762\u7684\u4f4d\u7f6e\u5373\u2018c\u2019\u3002 \u8fd9\u6837\u4f9d\u6b21\u79fb\u52a8end\u5230\u5b57\u7b26\u4e32\u672b\u5c3e\u5c31\u53ef\u4ee5\u627e\u5230\u6700\u957f\u7684\u5b50\u4e32\uff0c\u201c\u5b50\u4e32\u7a97\u53e3\u201d\u4e5f\u5c31\u4ece\u5934\u79fb\u5230\u4e86\u672b\u5c3e\u3002\u800c\u53ea\u9700\u8981end\u4ece\u5934\u5230\u5c3e\u7684\u4e00\u6b21\u5faa\u73af\u5373\u53ef\u3002 class [&hellip;]","og_url":"https:\/\/nemo.cool\/233.html","og_site_name":"Nemo","article_published_time":"2019-07-21T08:46:59+00:00","article_modified_time":"2019-08-08T11:06:21+00:00","og_image":[{"width":750,"height":452,"url":"https:\/\/nemo.cool\/wp-content\/uploads\/2019\/07\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg","type":"image\/jpeg"}],"author":"Nemo","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Nemo","Est. reading time":"8 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/nemo.cool\/233.html#article","isPartOf":{"@id":"https:\/\/nemo.cool\/233.html"},"author":{"name":"Nemo","@id":"https:\/\/nemo.cool\/#\/schema\/person\/698f803ee811e2b140a90f5d5de913d2"},"headline":"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32","datePublished":"2019-07-21T08:46:59+00:00","dateModified":"2019-08-08T11:06:21+00:00","mainEntityOfPage":{"@id":"https:\/\/nemo.cool\/233.html"},"wordCount":131,"commentCount":1,"publisher":{"@id":"https:\/\/nemo.cool\/#\/schema\/person\/698f803ee811e2b140a90f5d5de913d2"},"image":{"@id":"https:\/\/nemo.cool\/233.html#primaryimage"},"thumbnailUrl":"https:\/\/nemo.cool\/wp-content\/uploads\/2019\/07\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg","keywords":["leetcode","python","\u5b57\u7b26\u4e32\u7c7b","\u5b57\u8282\u8df3\u52a8","\u7b97\u6cd5"],"articleSection":["Algorithm Notes","Python"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/nemo.cool\/233.html#respond"]}]},{"@type":"WebPage","@id":"https:\/\/nemo.cool\/233.html","url":"https:\/\/nemo.cool\/233.html","name":"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32 - Nemo","isPartOf":{"@id":"https:\/\/nemo.cool\/#website"},"primaryImageOfPage":{"@id":"https:\/\/nemo.cool\/233.html#primaryimage"},"image":{"@id":"https:\/\/nemo.cool\/233.html#primaryimage"},"thumbnailUrl":"https:\/\/nemo.cool\/wp-content\/uploads\/2019\/07\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg","datePublished":"2019-07-21T08:46:59+00:00","dateModified":"2019-08-08T11:06:21+00:00","breadcrumb":{"@id":"https:\/\/nemo.cool\/233.html#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/nemo.cool\/233.html"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/nemo.cool\/233.html#primaryimage","url":"https:\/\/nemo.cool\/wp-content\/uploads\/2019\/07\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg","contentUrl":"https:\/\/nemo.cool\/wp-content\/uploads\/2019\/07\/cc1784ccfd1b436bb33dfff3aec2e9be.jpg","width":750,"height":452},{"@type":"BreadcrumbList","@id":"https:\/\/nemo.cool\/233.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/nemo.cool\/"},{"@type":"ListItem","position":2,"name":"\u5b57\u8282\u8df3\u52a8-\u6311\u6218\u5b57\u7b26\u4e32"}]},{"@type":"WebSite","@id":"https:\/\/nemo.cool\/#website","url":"https:\/\/nemo.cool\/","name":"Nemo","description":"","publisher":{"@id":"https:\/\/nemo.cool\/#\/schema\/person\/698f803ee811e2b140a90f5d5de913d2"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/nemo.cool\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/nemo.cool\/#\/schema\/person\/698f803ee811e2b140a90f5d5de913d2","name":"Nemo","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/nemo.cool\/wp-content\/uploads\/2024\/01\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg","url":"https:\/\/nemo.cool\/wp-content\/uploads\/2024\/01\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg","contentUrl":"https:\/\/nemo.cool\/wp-content\/uploads\/2024\/01\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg","caption":"Nemo"},"logo":{"@id":"https:\/\/nemo.cool\/wp-content\/uploads\/2024\/01\/Big_Hero_6_Anime_HD_desktop_wallpaper_01_1366x768-e1706020097529-96x96.jpg"},"sameAs":["https:\/\/nemo.cool"]}]}},"_links":{"self":[{"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/posts\/233","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/comments?post=233"}],"version-history":[{"count":0,"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/posts\/233\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/media\/237"}],"wp:attachment":[{"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/media?parent=233"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/categories?post=233"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nemo.cool\/wp-json\/wp\/v2\/tags?post=233"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}