{"id":108894,"date":"2026-09-22T23:17:18","date_gmt":"2026-09-22T15:17:18","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/108894.html"},"modified":"2026-09-22T23:17:18","modified_gmt":"2026-09-22T15:17:18","slug":"leetcode-438-%e6%89%be%e5%88%b0%e5%ad%97%e7%ac%a6%e4%b8%b2%e4%b8%ad%e6%89%80%e6%9c%89%e5%ad%97%e6%af%8d%e5%bc%82%e4%bd%8d%e8%af%8d-%e6%bb%91%e5%8a%a8%e7%aa%97%e5%8f%a3%e4%b8%8e-vec","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/108894.html","title":{"rendered":"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c"},"content":{"rendered":"<h3>\u9898\u76ee<\/h3>\n<p>LeetCode 438. Find All Anagrams in a String<img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"773\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260922151716-6ab29bfc48c44.png\" width=\"942\" \/><\/p>\n<p>\u7ed9\u5b9a\u4e24\u4e2a\u5b57\u7b26\u4e32 s \u548c p&#xff0c;\u627e\u5230 s \u4e2d\u6240\u6709 p \u7684\u5b57\u6bcd\u5f02\u4f4d\u8bcd\u7684\u5b50\u4e32&#xff0c;\u8fd4\u56de\u8fd9\u4e9b\u5b50\u4e32\u7684\u8d77\u59cb\u7d22\u5f15\u3002<\/p>\n<ul>\n<li>\n<p>\u5b57\u6bcd\u5f02\u4f4d\u8bcd&#xff1a;\u7531\u76f8\u540c\u5b57\u6bcd\u91cd\u65b0\u6392\u5217\u5f62\u6210\u7684\u5b57\u7b26\u4e32&#xff0c;\u5b57\u7b26\u79cd\u7c7b\u4e0e\u6570\u91cf\u76f8\u540c&#xff0c;\u987a\u5e8f\u65e0\u5173\u3002<\/p>\n<\/li>\n<li>\n<p>\u4f8b&#xff1a;s &#061; &#034;cbaebabacd&#034;, p &#061; &#034;abc&#034; \u2192 \u8f93\u51fa [0, 6]\u3002<\/p>\n<\/li>\n<\/ul>\n<h3>\u7b97\u6cd5&#xff1a;\u5b9a\u957f\u6ed1\u52a8\u7a97\u53e3 &#043; \u5b57\u7b26\u8ba1\u6570<\/h3>\n<p>\u6838\u5fc3\u601d\u60f3&#xff1a;\u5f02\u4f4d\u8bcd\u53ea\u8981\u6c42\u5b57\u7b26\u9891\u6b21\u76f8\u540c&#xff0c;\u4e0e\u987a\u5e8f\u65e0\u5173\u3002\u56e0\u6b64\u7ef4\u62a4\u4e00\u4e2a\u957f\u5ea6\u56fa\u5b9a\u4e3a p.size() \u7684\u7a97\u53e3&#xff0c;\u6bd4\u8f83\u7a97\u53e3\u5185\u5b57\u7b26\u9891\u6b21\u4e0e p \u7684\u5b57\u7b26\u9891\u6b21\u5373\u53ef\u3002<\/p>\n<p>\u6b65\u9aa4&#xff1a;<\/p>\n<li>\n<p>\u82e5 s.size() &lt; p.size()&#xff0c;\u76f4\u63a5\u8fd4\u56de\u7a7a\u3002<\/p>\n<\/li>\n<li>\n<p>\u7528 need[26] \u7edf\u8ba1 p \u4e2d\u5404\u5b57\u6bcd\u51fa\u73b0\u6b21\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>\u7528 window[26] \u7ef4\u62a4\u5f53\u524d\u7a97\u53e3\u5185\u5b57\u6bcd\u6b21\u6570\u3002<\/p>\n<\/li>\n<li>\n<p>\u53f3\u79fb\u7a97\u53e3&#xff1a;\u65b0\u5b57\u7b26\u5165\u7a97&#xff1b;\u5f53\u7a97\u53e3\u957f\u5ea6\u8d85\u8fc7 m \u65f6&#xff0c;\u5de6\u7aef\u5b57\u7b26\u51fa\u7a97\u3002<\/p>\n<\/li>\n<li>\n<p>\u7a97\u53e3\u957f\u5ea6\u6070\u4e3a m \u65f6&#xff0c;\u82e5 window &#061;&#061; need&#xff0c;\u8bb0\u5f55\u8d77\u59cb\u4e0b\u6807 i &#8211; m &#043; 1\u3002<\/p>\n<\/li>\n<p>\u590d\u6742\u5ea6&#xff1a;\u65f6\u95f4 O(n)&#xff0c;\u7a7a\u95f4 O(1)&#xff08;26 \u4e2a\u5b57\u6bcd\u7684\u5b9a\u957f\u6570\u7ec4&#xff09;\u3002<\/p>\n<h3>\u4ee3\u7801<\/h3>\n<p>class Solution {<br \/>\npublic:<br \/>\n    vector&lt;int&gt; findAnagrams(string s, string p) {<br \/>\n        vector&lt;int&gt; res;<br \/>\n        int n &#061; s.size(), m &#061; p.size();<br \/>\n        if (n &lt; m) return res;<\/p>\n<p>        vector&lt;int&gt; need(26, 0), window(26, 0);<br \/>\n        for (int i &#061; 0; i &lt; m; i&#043;&#043;) {<br \/>\n            need[p[i] &#8211; &#039;a&#039;]&#043;&#043;;<br \/>\n        }<\/p>\n<p>        for (int i &#061; 0; i &lt; n; i&#043;&#043;) {<br \/>\n            window[s[i] &#8211; &#039;a&#039;]&#043;&#043;;                    \/\/ \u53f3\u7aef\u5165\u7a97<br \/>\n            if (i &gt;&#061; m) window[s[i &#8211; m] &#8211; &#039;a&#039;]&#8211;;    \/\/ \u7a97\u53e3\u8d85\u8fc7 m&#xff0c;\u5de6\u7aef\u51fa\u7a97<br \/>\n            if (i &gt;&#061; m &#8211; 1 &amp;&amp; window &#061;&#061; need) {      \/\/ \u7a97\u53e3\u5927\u5c0f\u6070\u4e3a m \u65f6\u6bd4\u8f83<br \/>\n                res.push_back(i &#8211; m &#043; 1);            \/\/ \u8bb0\u5f55\u8d77\u59cb\u4e0b\u6807<br \/>\n            }<br \/>\n        }<br \/>\n        return res;<br \/>\n    }<br \/>\n}; <\/p>\n<p><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"641\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260922151717-6ab29bfd09896.png\" width=\"1007\" \/><\/p>\n<h3>\u77e5\u8bc6\u70b9&#xff1a;vector \u5e38\u7528\u64cd\u4f5c<\/h3>\n<h4>1. \u521d\u59cb\u5316<\/h4>\n<p>vector&lt;int&gt; a;                      \/\/ \u7a7a<br \/>\nvector&lt;int&gt; a(26, 0);               \/\/ 26 \u4e2a\u5143\u7d20&#xff0c;\u5168 0<br \/>\nvector&lt;int&gt; a{1, 2, 3};             \/\/ \u521d\u59cb\u5316\u5217\u8868&#xff1a;3 \u4e2a\u5143\u7d20<br \/>\nvector&lt;vector&lt;int&gt;&gt; mat(26, vector&lt;int&gt;(26, 0));  \/\/ 26\u00d726 \u4e8c\u7ef4 <\/p>\n<p>\u6ce8\u610f a(26) \u662f 26 \u4e2a\u5143\u7d20&#xff0c;a{26} \u662f 1 \u4e2a\u5143\u7d20\u503c\u4e3a 26&#xff0c;\u5706\u62ec\u53f7\u4e0e\u82b1\u62ec\u53f7\u8bed\u4e49\u4e0d\u540c\u3002<\/p>\n<h4>2. \u5b58\u50a8\u4e0e\u8bbf\u95ee<\/h4>\n<p>a.push_back(x);      \/\/ \u5c3e\u90e8\u8ffd\u52a0\u5143\u7d20&#xff08;\u52a8\u6001\u6269\u5bb9&#xff09;<br \/>\na[i];                \/\/ \u4e0b\u6807\u8bbf\u95ee&#xff0c;\u4e0d\u68c0\u67e5\u8d8a\u754c<br \/>\na.at(i);             \/\/ \u4e0b\u6807\u8bbf\u95ee&#xff0c;\u8d8a\u754c\u629b out_of_range<br \/>\na.back();            \/\/ \u6700\u540e\u4e00\u4e2a\u5143\u7d20<br \/>\na.front();           \/\/ \u7b2c\u4e00\u4e2a\u5143\u7d20 <\/p>\n<h4>3. \u5bb9\u91cf\u4e0e\u5927\u5c0f<\/h4>\n<p>a.size();            \/\/ \u5143\u7d20\u4e2a\u6570<br \/>\na.empty();           \/\/ \u662f\u5426\u4e3a\u7a7a<br \/>\na.reserve(1000);     \/\/ \u9884\u5206\u914d\u5bb9\u91cf&#xff0c;\u907f\u514d\u591a\u6b21\u6269\u5bb9<br \/>\na.capacity();        \/\/ \u5f53\u524d\u5bb9\u91cf <\/p>\n<h4>4. \u4fee\u6539<\/h4>\n<p>a.pop_back();        \/\/ \u5220\u9664\u5c3e\u90e8\u5143\u7d20<br \/>\na.clear();           \/\/ \u6e05\u7a7a&#xff08;size \u53d8 0&#xff0c;capacity \u901a\u5e38\u4e0d\u53d8&#xff09;<br \/>\na.insert(a.begin(), x);   \/\/ \u5728\u6307\u5b9a\u4f4d\u7f6e\u63d2\u5165<br \/>\na.erase(a.begin());       \/\/ \u5220\u9664\u6307\u5b9a\u4f4d\u7f6e\u5143\u7d20<br \/>\na.resize(10);        \/\/ \u8c03\u6574\u5927\u5c0f <\/p>\n<h4>5. \u904d\u5386<\/h4>\n<p>for (int i &#061; 0; i &lt; a.size(); i&#043;&#043;) cout &lt;&lt; a[i];<\/p>\n<p>for (const int&amp; x : a) cout &lt;&lt; x;          \/\/ \u8303\u56f4 for&#xff0c;\u63a8\u8350<\/p>\n<p>for (auto it &#061; a.begin(); it !&#061; a.end(); &#043;&#043;it) cout &lt;&lt; *it; <\/p>\n<h4>6. \u6bd4\u8f83<\/h4>\n<p>window &#061;&#061; need;      \/\/ \u9010\u5143\u7d20\u6bd4\u8f83&#xff0c;\u76f8\u7b49\u8fd4\u56de true <\/p>\n<p>\u672c\u4f8b\u6b63\u662f\u5229\u7528 vector \u7684 operator&#061;&#061; \u76f4\u63a5\u6bd4\u8f83\u4e24\u4e2a 26 \u957f\u5ea6\u7684\u8ba1\u6570\u6570\u7ec4\u3002<\/p>\n<h3>\u6613\u9519\u70b9\u5c0f\u7ed3<\/h3>\n<table>\n<tr>\u6613\u9519\u70b9\u6b63\u786e\u505a\u6cd5<\/tr>\n<tbody>\n<tr>\n<td style=\"text-align:center\">\u51fa\u7a97\u6761\u4ef6\u5199\u6210 i &gt; m<\/td>\n<td style=\"text-align:center\">\u5e94\u4e3a i &gt;&#061; m<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">vector&lt;int&gt; a{26} \u8bef\u5f53\u4f5c 26 \u4e2a\u5143\u7d20<\/td>\n<td style=\"text-align:center\">{} \u662f\u521d\u59cb\u5316\u5217\u8868&#xff0c;() \u624d\u662f\u957f\u5ea6<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u7528 string \u8d1f\u6570\u4e0b\u6807<\/td>\n<td style=\"text-align:center\">string::operator[] \u53c2\u6570\u65e0\u7b26\u53f7&#xff0c;\u8d1f\u4e0b\u6807\u5bfc\u81f4 UB&#xff0c;\u8bbf\u95ee\u524d\u5224\u8fb9\u754c<\/td>\n<\/tr>\n<tr>\n<td style=\"text-align:center\">\u6bcf\u6b21\u6bd4\u8f83 26 \u4e2a\u5143\u7d20<\/td>\n<td style=\"text-align:center\">\u53ef\u7528 diff \u7ef4\u62a4\u5dee\u5f02\u6570\u4f18\u5316\u81f3 O(1) \u6bd4\u8f83<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n","protected":false},"excerpt":{"rendered":"<p>\u9898\u76ee<br \/>\nLeetCode 438. Find All Anagrams in a String<br \/>\n\u7ed9\u5b9a\u4e24\u4e2a\u5b57\u7b26\u4e32 s \u548c p&#xff0c;\u627e\u5230 s \u4e2d\u6240\u6709 p \u7684\u5b57\u6bcd\u5f02\u4f4d\u8bcd\u7684\u5b50\u4e32&#xff0c;\u8fd4\u56de\u8fd9\u4e9b\u5b50\u4e32\u7684\u8d77\u59cb\u7d22\u5f15\u3002 \u5b57\u6bcd\u5f02\u4f4d\u8bcd&#xff1a;\u7531\u76f8\u540c\u5b57\u6bcd\u91cd\u65b0\u6392\u5217\u5f62\u6210\u7684\u5b57\u7b26\u4e32&#xff0c;\u5b57\u7b26\u79cd\u7c7b\u4e0e\u6570\u91cf\u76f8\u540c&#xff0c;\u987a\u5e8f\u65e0\u5173\u3002  \u4f8b&#xff1a;s  \\&#8221;cbaebabacd\\&#8221;, p  \\&#8221;abc\\&#8221; \u2192 \u8f93\u51fa [0, 6]\u3002  \u7b97\u6cd5&#xff1a;\u5b9a\u957f\u6ed1\u52a8\u7a97\u53e3  \u5b57\u7b26<\/p>\n","protected":false},"author":2,"featured_media":108892,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[55,2692,2762],"topic":[],"class_list":["post-108894","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-c","tag-leetcode","tag-vector"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c - \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\/108894.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u9898\u76ee LeetCode 438. Find All Anagrams in a String \u7ed9\u5b9a\u4e24\u4e2a\u5b57\u7b26\u4e32 s \u548c p&#xff0c;\u627e\u5230 s \u4e2d\u6240\u6709 p \u7684\u5b57\u6bcd\u5f02\u4f4d\u8bcd\u7684\u5b50\u4e32&#xff0c;\u8fd4\u56de\u8fd9\u4e9b\u5b50\u4e32\u7684\u8d77\u59cb\u7d22\u5f15\u3002 \u5b57\u6bcd\u5f02\u4f4d\u8bcd&#xff1a;\u7531\u76f8\u540c\u5b57\u6bcd\u91cd\u65b0\u6392\u5217\u5f62\u6210\u7684\u5b57\u7b26\u4e32&#xff0c;\u5b57\u7b26\u79cd\u7c7b\u4e0e\u6570\u91cf\u76f8\u540c&#xff0c;\u987a\u5e8f\u65e0\u5173\u3002 \u4f8b&#xff1a;s &quot;cbaebabacd&quot;, p &quot;abc&quot; \u2192 \u8f93\u51fa [0, 6]\u3002 \u7b97\u6cd5&#xff1a;\u5b9a\u957f\u6ed1\u52a8\u7a97\u53e3 \u5b57\u7b26\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/108894.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-09-22T15:17:18+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260922151716-6ab29bfc48c44.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=\"2 \u5206\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108894.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/108894.html\",\"name\":\"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-09-22T15:17:18+00:00\",\"dateModified\":\"2026-09-22T15:17:18+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/108894.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/108894.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/108894.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c\"}]},{\"@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":"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c - \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\/108894.html","og_locale":"zh_CN","og_type":"article","og_title":"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u9898\u76ee LeetCode 438. Find All Anagrams in a String \u7ed9\u5b9a\u4e24\u4e2a\u5b57\u7b26\u4e32 s \u548c p&#xff0c;\u627e\u5230 s \u4e2d\u6240\u6709 p \u7684\u5b57\u6bcd\u5f02\u4f4d\u8bcd\u7684\u5b50\u4e32&#xff0c;\u8fd4\u56de\u8fd9\u4e9b\u5b50\u4e32\u7684\u8d77\u59cb\u7d22\u5f15\u3002 \u5b57\u6bcd\u5f02\u4f4d\u8bcd&#xff1a;\u7531\u76f8\u540c\u5b57\u6bcd\u91cd\u65b0\u6392\u5217\u5f62\u6210\u7684\u5b57\u7b26\u4e32&#xff0c;\u5b57\u7b26\u79cd\u7c7b\u4e0e\u6570\u91cf\u76f8\u540c&#xff0c;\u987a\u5e8f\u65e0\u5173\u3002 \u4f8b&#xff1a;s \"cbaebabacd\", p \"abc\" \u2192 \u8f93\u51fa [0, 6]\u3002 \u7b97\u6cd5&#xff1a;\u5b9a\u957f\u6ed1\u52a8\u7a97\u53e3 \u5b57\u7b26","og_url":"https:\/\/www.wsisp.com\/helps\/108894.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-09-22T15:17:18+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/09\/20260922151716-6ab29bfc48c44.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin","\u9884\u8ba1\u9605\u8bfb\u65f6\u95f4":"2 \u5206"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/108894.html","url":"https:\/\/www.wsisp.com\/helps\/108894.html","name":"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-09-22T15:17:18+00:00","dateModified":"2026-09-22T15:17:18+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/108894.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/108894.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/108894.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"LeetCode 438. \u627e\u5230\u5b57\u7b26\u4e32\u4e2d\u6240\u6709\u5b57\u6bcd\u5f02\u4f4d\u8bcd \u2014\u2014 \u6ed1\u52a8\u7a97\u53e3\u4e0e vector \u5e38\u7528\u64cd\u4f5c"}]},{"@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\/108894","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=108894"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/108894\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/108892"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=108894"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=108894"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=108894"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=108894"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}