{"id":72622,"date":"2026-02-06T09:25:42","date_gmt":"2026-02-06T01:25:42","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/72622.html"},"modified":"2026-02-06T09:25:42","modified_gmt":"2026-02-06T01:25:42","slug":"%e3%80%90%e7%ae%97%e6%b3%95%e9%9d%a2%e8%af%95%e5%bf%85%e5%88%b7%e3%80%91","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/72622.html","title":{"rendered":"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011"},"content":{"rendered":"<p id=\"main-toc\">\u76ee\u5f55<\/p>\n<p id=\"%E9%A2%98%E7%9B%AE-toc\" style=\"margin-left:0px\">\u9898\u76ee<\/p>\n<p id=\"%E2%80%8B%E7%BC%96%E8%BE%91-toc\" style=\"margin-left:0px\">\u200b\u7f16\u8f91<\/p>\n<p id=\"%E9%A2%98%E7%9B%AE%E9%93%BE%E6%8E%A5-toc\" style=\"margin-left:0px\">\u9898\u76ee\u94fe\u63a5<\/p>\n<p id=\"%E6%80%9D%E8%B7%AF-toc\" style=\"margin-left:0px\">\u601d\u8def<\/p>\n<p id=\"%E5%A4%8D%E6%9D%82%E5%BA%A6-toc\" style=\"margin-left:0px\">\u590d\u6742\u5ea6<\/p>\n<p id=\"%E6%97%B6%E9%97%B4%E5%A4%8D%E6%9D%82%E5%BA%A6%EF%BC%9AO(n)-toc\" style=\"margin-left:80px\">\u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)<\/p>\n<p id=\"%E7%A9%BA%E9%97%B4%E5%A4%8D%E6%9D%82%E5%BA%A6%EF%BC%9AO(min(n%2C%20m))-toc\" style=\"margin-left:80px\">\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(min(n, m))<\/p>\n<p id=\"%E4%BB%A3%E7%A0%81-toc\" style=\"margin-left:0px\">\u4ee3\u7801<\/p>\n<hr id=\"hr-toc\" \/>\n<h2 id=\"%E9%A2%98%E7%9B%AE\">\u9898\u76ee<\/h2>\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0s\u00a0&#xff0c;\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684\u00a0\u6700\u957f\u00a0\u5b50\u4e32\u00a0\u7684\u957f\u5ea6\u3002<\/p>\n<p>\u793a\u4f8b 1:<\/p>\n<p>\u8f93\u5165: s &#061; &#034;abcabcbb&#034;<br \/>\n\u8f93\u51fa: 3<br \/>\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &#034;abc&#034;&#xff0c;\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002\u6ce8\u610f &#034;bca&#034; \u548c &#034;cab&#034; \u4e5f\u662f\u6b63\u786e\u7b54\u6848\u3002<br \/>\n\u793a\u4f8b 2:<\/p>\n<p>\u8f93\u5165: s &#061; &#034;bbbbb&#034;<br \/>\n\u8f93\u51fa: 1<br \/>\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &#034;b&#034;&#xff0c;\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 1\u3002<br \/>\n\u793a\u4f8b 3:<\/p>\n<p>\u8f93\u5165: s &#061; &#034;pwwkew&#034;<br \/>\n\u8f93\u51fa: 3<br \/>\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &#034;wke&#034;&#xff0c;\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002<br \/>\n     \u8bf7\u6ce8\u610f&#xff0c;\u4f60\u7684\u7b54\u6848\u5fc5\u987b\u662f \u5b50\u4e32 \u7684\u957f\u5ea6&#xff0c;&#034;pwke&#034; \u662f\u4e00\u4e2a\u5b50\u5e8f\u5217&#xff0c;\u4e0d\u662f\u5b50\u4e32\u3002 <\/p>\n<h2 id=\"%E2%80%8B%E7%BC%96%E8%BE%91\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"168\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260206012541-698543150f85d.png\" width=\"459\" \/><\/h2>\n<h2 id=\"%E9%A2%98%E7%9B%AE%E9%93%BE%E6%8E%A5\">\u9898\u76ee\u94fe\u63a5<\/h2>\n<p><span class=\"link-card-box\"><span class=\"link-title\">3. \u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32 &#8211; \u529b\u6263&#xff08;LeetCode&#xff09;<\/span><span class=\"link-link\"><img decoding=\"async\" class=\"link-link-icon\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260206012541-698543151ec39.png\" \/>https:\/\/leetcode.cn\/problems\/longest-substring-without-repeating-characters\/description\/?envType&#061;study-plan-v2&amp;envId&#061;top-100-liked<\/span><\/span><\/p>\n<h2 id=\"%E6%80%9D%E8%B7%AF\">\u601d\u8def<\/h2>\n<p>\u6838\u5fc3\u601d\u60f3&#xff1a;\u6ed1\u52a8\u7a97\u53e3 &#043; \u54c8\u5e0c\u96c6\u5408<\/p>\n<p>\u6ed1\u52a8\u7a97\u53e3&#xff1a;<\/p>\n<ul>\n<li>\n<p>\u7a97\u53e3\u5b9a\u4e49&#xff1a;\u5f53\u524d\u8003\u5bdf\u7684\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u5b50\u4e32<\/p>\n<\/li>\n<li>\n<p>\u5de6\u6307\u9488&#xff08;left&#xff09;&#xff1a;\u7a97\u53e3\u7684\u5de6\u8fb9\u754c<\/p>\n<\/li>\n<li>\n<p>\u53f3\u6307\u9488&#xff08;right&#xff09;&#xff1a;\u7a97\u53e3\u7684\u53f3\u8fb9\u754c&#xff0c;\u4e0d\u65ad\u5411\u53f3\u6269\u5c55<\/p>\n<\/li>\n<\/ul>\n<p>\u54c8\u5e0c\u96c6\u5408\u7684\u4f5c\u7528&#xff1a;<\/p>\n<li>\n<p>\u5feb\u901f\u67e5\u91cd&#xff1a;O(1)\u65f6\u95f4\u5224\u65ad\u5b57\u7b26\u662f\u5426\u5728\u7a97\u53e3\u4e2d<\/p>\n<\/li>\n<li>\n<p>\u5b58\u50a8\u5f53\u524d\u7a97\u53e3&#xff1a;\u4fdd\u5b58\u7a97\u53e3\u4e2d\u7684\u6240\u6709\u5b57\u7b26<\/p>\n<\/li>\n<h2 id=\"%E5%A4%8D%E6%9D%82%E5%BA%A6\">\u590d\u6742\u5ea6<\/h2>\n<h4 id=\"%E6%97%B6%E9%97%B4%E5%A4%8D%E6%9D%82%E5%BA%A6%EF%BC%9AO(n)\">\u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)<\/h4>\n<p>\u867d\u7136\u4ee3\u7801\u4e2d\u6709\u5d4c\u5957\u5faa\u73af&#xff08;while\u00a0\u5728\u00a0for\u00a0\u5185\u90e8&#xff09;&#xff0c;\u4f46\u6bcf\u4e2a\u5b57\u7b26\u6700\u591a\u88ab\u8bbf\u95ee\u4e24\u6b21&#xff1a;<\/p>\n<p>\u5206\u6790&#xff1a;<\/p>\n<p>\u5916\u5c42\u5faa\u73af&#xff1a;\u53f3\u6307\u9488 right \u79fb\u52a8 n \u6b21<br \/>\n\u5185\u5c42 while \u5faa\u73af&#xff1a;\u5de6\u6307\u9488 left \u79fb\u52a8\u7684\u603b\u6b21\u6570\u4e0d\u8d85\u8fc7 n \u6b21<\/p>\n<p>\u603b\u64cd\u4f5c\u6b21\u6570&#xff1a;O(2n) &#061; O(n) <\/p>\n<p>\u4e3a\u4ec0\u4e48\u662f O(n) \u800c\u4e0d\u662f O(n\u00b2)&#xff1f;<\/p>\n<p>\u6bcf\u4e2a\u5b57\u7b26\u6700\u591a\u88ab&#xff1a;<br \/>\n1. \u53f3\u6307\u9488\u8bbf\u95ee\u4e00\u6b21&#xff08;\u52a0\u5165\u96c6\u5408&#xff09;<br \/>\n2. \u5de6\u6307\u9488\u8bbf\u95ee\u4e00\u6b21&#xff08;\u4ece\u96c6\u5408\u5220\u9664&#xff09;<\/p>\n<p>\u6240\u4ee5\u603b\u5171\u6700\u591a 2n \u6b21\u64cd\u4f5c&#xff0c;\u5373 O(n) <\/p>\n<h4 id=\"%E7%A9%BA%E9%97%B4%E5%A4%8D%E6%9D%82%E5%BA%A6%EF%BC%9AO(min(n%2C%20m))\">\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(min(n, m))<\/h4>\n<p>charSet \u5b58\u50a8\u7a97\u53e3\u4e2d\u7684\u5b57\u7b26<br \/>\n\u7a97\u53e3\u5927\u5c0f \u2264 min(n, \u5b57\u7b26\u96c6\u5927\u5c0f)<\/p>\n<p>\u82f1\u6587\u5b57\u7b26\u96c6&#xff1a;\u6700\u591a 26 \u4e2a\u5b57\u6bcd \u2192 O(26) &#061; O(1)<br \/>\nASCII \u5b57\u7b26\u96c6&#xff1a;\u6700\u591a 128 \u4e2a\u5b57\u7b26 \u2192 O(128) &#061; O(1)<br \/>\nUnicode&#xff1a;\u53ef\u80fd\u66f4\u591a&#xff0c;\u4f46\u4e00\u822c\u8fd8\u662f O(\u5b57\u7b26\u96c6\u5927\u5c0f)<\/p>\n<p>\u4f46\u9898\u76ee\u901a\u5e38\u9650\u5236\u4e3a\u82f1\u6587\u5b57\u6bcd\u3001\u6570\u5b57\u3001\u7b26\u53f7\u7b49&#xff0c;\u6240\u4ee5\u53ef\u4ee5\u8ba4\u4e3a\u662f O(1)<br \/>\n\u66f4\u51c6\u786e\u5730\u8bf4&#xff1a;O(min(n, \u5b57\u7b26\u96c6\u5927\u5c0f)) <\/p>\n<h2 id=\"%E4%BB%A3%E7%A0%81\">\u4ee3\u7801<\/h2>\n<p>class Solution {<br \/>\npublic:<br \/>\n    int lengthOfLongestSubstring(string s) {<br \/>\n        \/\/ \u4f7f\u7528\u54c8\u5e0c\u96c6\u5408\u5b58\u50a8\u5f53\u524d\u7a97\u53e3\u4e2d\u7684\u5b57\u7b26&#xff08;\u7528\u4e8e\u5feb\u901f\u5224\u65ad\u91cd\u590d&#xff09;<br \/>\n        unordered_set&lt;char&gt; charSet;<\/p>\n<p>        int n &#061; s.size();      \/\/ \u5b57\u7b26\u4e32\u957f\u5ea6<br \/>\n        int ans &#061; 0;           \/\/ \u6700\u957f\u65e0\u91cd\u590d\u5b50\u4e32\u7684\u957f\u5ea6<\/p>\n<p>        \/\/ \u6ed1\u52a8\u7a97\u53e3&#xff1a;\u5de6\u6307\u9488l&#xff0c;\u53f3\u6307\u9488r<br \/>\n        \/\/ \u5916\u5c42\u5faa\u73af&#xff1a;\u53f3\u6307\u9488\u4e0d\u65ad\u5411\u53f3\u6269\u5c55<br \/>\n        for (int left &#061; 0, right &#061; 0; right &lt; n; right&#043;&#043;) {<\/p>\n<p>            \/\/ \u5173\u952e&#xff1a;\u5982\u679c\u5f53\u524d\u5b57\u7b26 s[right] \u5df2\u7ecf\u5728\u96c6\u5408\u4e2d<br \/>\n            \/\/ \u8bf4\u660e\u51fa\u73b0\u4e86\u91cd\u590d&#xff0c;\u9700\u8981\u6536\u7f29\u7a97\u53e3<br \/>\n            while (charSet.find(s[right]) !&#061; charSet.end()) {<br \/>\n                \/\/ \u4ece\u96c6\u5408\u4e2d\u79fb\u9664\u5de6\u6307\u9488\u6307\u5411\u7684\u5b57\u7b26<br \/>\n                \/\/ \u5de6\u6307\u9488\u5411\u53f3\u79fb\u52a8&#xff0c;\u76f4\u5230\u79fb\u9664\u6389\u90a3\u4e2a\u91cd\u590d\u7684\u5b57\u7b26<br \/>\n                charSet.erase(s[left]);<br \/>\n                left&#043;&#043;;  \/\/ \u5de6\u6307\u9488\u53f3\u79fb<br \/>\n            }<\/p>\n<p>            \/\/ \u5c06\u5f53\u524d\u5b57\u7b26\u52a0\u5165\u96c6\u5408&#xff08;\u73b0\u5728\u96c6\u5408\u4e2d\u6ca1\u6709\u91cd\u590d\u4e86&#xff09;<br \/>\n            charSet.insert(s[right]);<\/p>\n<p>            \/\/ \u8ba1\u7b97\u5f53\u524d\u7a97\u53e3\u7684\u5927\u5c0f&#xff08;\u65e0\u91cd\u590d\u5b50\u4e32\u7684\u957f\u5ea6&#xff09;<br \/>\n            int currentLength &#061; charSet.size();<\/p>\n<p>            \/\/ \u66f4\u65b0\u6700\u5927\u957f\u5ea6<br \/>\n            ans &#061; max(ans, currentLength);<\/p>\n<p>            \/\/ \u4e5f\u53ef\u4ee5\u8fd9\u6837\u8ba1\u7b97&#xff1a;ans &#061; max(ans, right &#8211; left &#043; 1);<br \/>\n        }<\/p>\n<p>        return ans;<br \/>\n    }<br \/>\n}; <\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u76ee\u5f55<br \/>\n\u9898\u76ee<br \/>\n\u200b\u7f16\u8f91<br \/>\n\u9898\u76ee\u94fe\u63a5<br \/>\n\u601d\u8def<br \/>\n\u590d\u6742\u5ea6<br \/>\n\u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n)<br \/>\n\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(min(n, m))<br \/>\n\u4ee3\u7801 \u9898\u76ee<br \/>\n\u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0s\u00a0&#xff0c;\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684\u00a0\u6700\u957f\u00a0\u5b50\u4e32\u00a0\u7684\u957f\u5ea6\u3002<br \/>\n\u793a\u4f8b 1:\u8f93\u5165: s  \\&#8221;abcabcbb\\&#8221;<br \/>\n\u8f93\u51fa: 3<br \/>\n\u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f \\&#8221;abc\\&#8221;&#xff0c;\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002\u6ce8\u610f \\&#8221;bca\\&#8221; \u548c \\&#8221;cab\\&#8221; \u4e5f\u662f\u6b63\u786e\u7b54\u6848\u3002<br \/>\n\u793a\u4f8b 2:\u8f93\u5165: s  \\&#8221;bbbbb\\&#8221;<\/p>\n","protected":false},"author":2,"featured_media":72620,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[427],"topic":[],"class_list":["post-72622","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3<\/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:\/\/www.wsisp.com\/helps\/72622.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u76ee\u5f55 \u9898\u76ee \u200b\u7f16\u8f91 \u9898\u76ee\u94fe\u63a5 \u601d\u8def \u590d\u6742\u5ea6 \u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n) \u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(min(n, m)) \u4ee3\u7801 \u9898\u76ee \u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0s\u00a0&#xff0c;\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684\u00a0\u6700\u957f\u00a0\u5b50\u4e32\u00a0\u7684\u957f\u5ea6\u3002 \u793a\u4f8b 1:\u8f93\u5165: s &quot;abcabcbb&quot; \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f &quot;abc&quot;&#xff0c;\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002\u6ce8\u610f &quot;bca&quot; \u548c &quot;cab&quot; \u4e5f\u662f\u6b63\u786e\u7b54\u6848\u3002 \u793a\u4f8b 2:\u8f93\u5165: s &quot;bbbbb&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/72622.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-02-06T01:25:42+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260206012541-698543150f85d.png\" \/>\n<meta name=\"author\" content=\"admin\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"\u4f5c\u8005\" \/>\n\t<meta name=\"twitter:data1\" content=\"admin\" \/>\n\t<meta name=\"twitter:label2\" content=\"\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4\" \/>\n\t<meta name=\"twitter:data2\" content=\"1 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72622.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/72622.html\",\"name\":\"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-02-06T01:25:42+00:00\",\"dateModified\":\"2026-02-06T01:25:42+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/72622.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/72622.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/72622.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\",\"url\":\"https:\/\/www.wsisp.com\/helps\/\",\"name\":\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"description\":\"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"zh-Hans\"},{\"@type\":\"Person\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\",\"name\":\"admin\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"zh-Hans\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"contentUrl\":\"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery\",\"caption\":\"admin\"},\"sameAs\":[\"http:\/\/wp.wsisp.com\"],\"url\":\"https:\/\/www.wsisp.com\/helps\/author\/admin\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","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:\/\/www.wsisp.com\/helps\/72622.html","og_locale":"zh_CN","og_type":"article","og_title":"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u76ee\u5f55 \u9898\u76ee \u200b\u7f16\u8f91 \u9898\u76ee\u94fe\u63a5 \u601d\u8def \u590d\u6742\u5ea6 \u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(n) \u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(min(n, m)) \u4ee3\u7801 \u9898\u76ee \u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0s\u00a0&#xff0c;\u8bf7\u4f60\u627e\u51fa\u5176\u4e2d\u4e0d\u542b\u6709\u91cd\u590d\u5b57\u7b26\u7684\u00a0\u6700\u957f\u00a0\u5b50\u4e32\u00a0\u7684\u957f\u5ea6\u3002 \u793a\u4f8b 1:\u8f93\u5165: s \"abcabcbb\" \u8f93\u51fa: 3 \u89e3\u91ca: \u56e0\u4e3a\u65e0\u91cd\u590d\u5b57\u7b26\u7684\u6700\u957f\u5b50\u4e32\u662f \"abc\"&#xff0c;\u6240\u4ee5\u5176\u957f\u5ea6\u4e3a 3\u3002\u6ce8\u610f \"bca\" \u548c \"cab\" \u4e5f\u662f\u6b63\u786e\u7b54\u6848\u3002 \u793a\u4f8b 2:\u8f93\u5165: s \"bbbbb\"","og_url":"https:\/\/www.wsisp.com\/helps\/72622.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-02-06T01:25:42+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/02\/20260206012541-698543150f85d.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"1 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/72622.html","url":"https:\/\/www.wsisp.com\/helps\/72622.html","name":"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-02-06T01:25:42+00:00","dateModified":"2026-02-06T01:25:42+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/72622.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/72622.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/72622.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"\u3010\u7b97\u6cd5\u9762\u8bd5\u5fc5\u5237\u3011"}]},{"@type":"WebSite","@id":"https:\/\/www.wsisp.com\/helps\/#website","url":"https:\/\/www.wsisp.com\/helps\/","name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","description":"\u9999\u6e2f\u670d\u52a1\u5668_\u9999\u6e2f\u4e91\u670d\u52a1\u5668\u8d44\u8baf_\u670d\u52a1\u5668\u5e2e\u52a9\u6587\u6863_\u670d\u52a1\u5668\u6559\u7a0b","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.wsisp.com\/helps\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"zh-Hans"},{"@type":"Person","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41","name":"admin","image":{"@type":"ImageObject","inLanguage":"zh-Hans","@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/image\/","url":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","contentUrl":"https:\/\/gravatar.wp-china-yes.net\/avatar\/?s=96&d=mystery","caption":"admin"},"sameAs":["http:\/\/wp.wsisp.com"],"url":"https:\/\/www.wsisp.com\/helps\/author\/admin"}]}},"_links":{"self":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72622","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/comments?post=72622"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/72622\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/72620"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=72622"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=72622"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=72622"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=72622"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}