{"id":121028,"date":"2026-11-02T00:33:35","date_gmt":"2026-11-01T16:33:35","guid":{"rendered":"https:\/\/www.wsisp.com\/helps\/121028.html"},"modified":"2026-11-02T00:33:35","modified_gmt":"2026-11-01T16:33:35","slug":"leetcode100-11-%e7%9b%9b%e6%9c%80%e5%a4%9a%e6%b0%b4%e7%9a%84%e5%ae%b9%e5%99%a8","status":"publish","type":"post","link":"https:\/\/www.wsisp.com\/helps\/121028.html","title":{"rendered":"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668"},"content":{"rendered":"<p id=\"u7c218ef0\">\n<p class=\"img-center\"><img loading=\"lazy\" decoding=\"async\" alt=\"\" height=\"765\" id=\"uc3537a18\" src=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101163333-6ae769ddc4cb7.png\" width=\"847\" \/><\/p>\n<p id=\"u3820a118\">\u4ece\u4e24\u904d\u5411\u4e2d\u95f4\u904d\u5386<\/p>\n<p id=\"ue3173b77\">\u6c34\u6876\u5728\u8d8a\u6765\u8d8a\u7a84\u7684\u60c5\u51b5\u4e0b\u53ea\u6709\u6362\u77ed\u677f\u624d\u6709\u53ef\u80fd\u901a\u8fc7\u589e\u52a0\u9ad8\u5ea6\u4ece\u800c\u589e\u52a0\u76db\u6c34\u91cf\u3002<\/p>\n<p id=\"ud4645031\">\u5047\u8bbe\u5de6\u77ee\u53f3\u9ad8&#xff1a;\u9762\u79ef\u7531\u5de6\u8fb9\u77ed\u677f\u51b3\u5b9a\u3002\u5982\u679c\u79fb\u52a8\u53f3\u6307\u9488&#xff0c;\u5bbd\u5ea6\u53d8\u5c0f&#xff0c;\u77ed\u677f\u8fd8\u662f\u5de6\u8fb9&#xff0c;\u9762\u79ef\u4e00\u5b9a\u4e0d\u4f1a\u66f4\u5927&#xff1b;\u53ea\u6709\u79fb\u52a8\u77ed\u677f&#xff0c;\u624d\u6709\u53ef\u80fd\u627e\u5230\u66f4\u9ad8\u7684\u6321\u677f&#xff0c;\u9762\u79ef\u53d8\u5927\u3002<\/p>\n<p>class Solution {<br \/>\n    public int maxArea(int[] height) {<br \/>\n        int l &#061; 0;<br \/>\n        int r &#061; height.length &#8211; 1;<br \/>\n        int maxVolume &#061; 0;<\/p>\n<p>        while (l !&#061; r) {<br \/>\n            \/\/ \u9762\u79ef &#061; \u4e24\u6839\u67f1\u5b50\u8f83\u77ee\u7684\u9ad8\u5ea6 \u00d7 \u4e24\u6839\u67f1\u5b50\u4e4b\u95f4\u7684\u8ddd\u79bb<br \/>\n            maxVolume &#061; Math.max(maxVolume, Math.min(height[l], height[r]) * (r &#8211; l));<br \/>\n            \/\/ \u79fb\u52a8\u8f83\u77ee\u4e00\u4fa7\u7684\u6307\u9488&#xff08;\u77ed\u677f\u51b3\u5b9a\u9ad8\u5ea6&#xff0c;\u79fb\u52a8\u9ad8\u677f\u9762\u79ef\u53ea\u4f1a\u66f4\u5c0f&#xff09;<br \/>\n            if (height[l] &lt;&#061; height[r]) {<br \/>\n                l&#043;&#043;;                        \/\/ \u5de6\u77ee&#xff0c;\u53f3\u79fb\u5de6\u6307\u9488&#xff0c;\u8bd5\u56fe\u627e\u5230\u66f4\u9ad8\u7684\u5de6\u677f<br \/>\n            } else {<br \/>\n                r&#8211;;                        \/\/ \u53f3\u77ee&#xff0c;\u5de6\u79fb\u53f3\u6307\u9488&#xff0c;\u8bd5\u56fe\u627e\u5230\u66f4\u9ad8\u7684\u53f3\u677f<br \/>\n            }<br \/>\n        }<br \/>\n        return maxVolume;<br \/>\n    }<br \/>\n}<\/p>\n<p id=\"u8a15a5f4\">\u65f6\u95f4\u590d\u6742\u5ea6&#xff1a;O(N)&#xff0c;\u53cc\u6307\u9488\u603b\u8ba1\u6700\u591a\u904d\u5386\u6574\u4e2a\u6570\u7ec4\u4e00\u6b21\u3002<\/p>\n<p id=\"u1bb8959f\">\u7a7a\u95f4\u590d\u6742\u5ea6&#xff1a;O(1)<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4ece\u4e24\u904d\u5411\u4e2d\u95f4\u904d\u5386\u6c34\u6876\u5728\u8d8a\u6765\u8d8a\u7a84\u7684\u60c5\u51b5\u4e0b\u53ea\u6709\u6362\u77ed\u677f\u624d\u6709\u53ef\u80fd\u901a\u8fc7\u589e\u52a0\u9ad8\u5ea6\u4ece\u800c\u589e\u52a0\u76db\u6c34\u91cf\u3002\u5047\u8bbe\u5de6\u77ee\u53f3\u9ad8&#xff1a;\u9762\u79ef\u7531\u5de6\u8fb9\u77ed\u677f\u51b3\u5b9a\u3002\u5982\u679c\u79fb\u52a8\u53f3\u6307\u9488&#xff0c;\u5bbd\u5ea6\u53d8\u5c0f&#xff0c;\u77ed\u677f\u8fd8\u662f\u5de6\u8fb9&#xff0c;\u9762\u79ef\u4e00\u5b9a\u4e0d\u4f1a\u66f4\u5927&#xff1b;\u53ea\u6709\u79fb\u52a8\u77ed\u677f&#xff0c;\u624d\u6709\u53ef\u80fd\u627e\u5230\u66f4\u9ad8\u7684\u6321\u677f&#xff0c;\u9762\u79ef\u53d8\u5927\u3002class Solution {public int maxArea(int[] height) {int l  0;int r  height.length<\/p>\n","protected":false},"author":2,"featured_media":121027,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[2692,427],"topic":[],"class_list":["post-121028","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-server","tag-leetcode","tag-427"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.3 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668 - \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\/121028.html\" \/>\n<meta property=\"og:locale\" content=\"zh_CN\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"og:description\" content=\"\u4ece\u4e24\u904d\u5411\u4e2d\u95f4\u904d\u5386\u6c34\u6876\u5728\u8d8a\u6765\u8d8a\u7a84\u7684\u60c5\u51b5\u4e0b\u53ea\u6709\u6362\u77ed\u677f\u624d\u6709\u53ef\u80fd\u901a\u8fc7\u589e\u52a0\u9ad8\u5ea6\u4ece\u800c\u589e\u52a0\u76db\u6c34\u91cf\u3002\u5047\u8bbe\u5de6\u77ee\u53f3\u9ad8&#xff1a;\u9762\u79ef\u7531\u5de6\u8fb9\u77ed\u677f\u51b3\u5b9a\u3002\u5982\u679c\u79fb\u52a8\u53f3\u6307\u9488&#xff0c;\u5bbd\u5ea6\u53d8\u5c0f&#xff0c;\u77ed\u677f\u8fd8\u662f\u5de6\u8fb9&#xff0c;\u9762\u79ef\u4e00\u5b9a\u4e0d\u4f1a\u66f4\u5927&#xff1b;\u53ea\u6709\u79fb\u52a8\u77ed\u677f&#xff0c;\u624d\u6709\u53ef\u80fd\u627e\u5230\u66f4\u9ad8\u7684\u6321\u677f&#xff0c;\u9762\u79ef\u53d8\u5927\u3002class Solution {public int maxArea(int[] height) {int l 0;int r height.length\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.wsisp.com\/helps\/121028.html\" \/>\n<meta property=\"og:site_name\" content=\"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\" \/>\n<meta property=\"article:published_time\" content=\"2026-11-01T16:33:35+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101163333-6ae769ddc4cb7.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<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121028.html\",\"url\":\"https:\/\/www.wsisp.com\/helps\/121028.html\",\"name\":\"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3\",\"isPartOf\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#website\"},\"datePublished\":\"2026-11-01T16:33:35+00:00\",\"dateModified\":\"2026-11-01T16:33:35+00:00\",\"author\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41\"},\"breadcrumb\":{\"@id\":\"https:\/\/www.wsisp.com\/helps\/121028.html#breadcrumb\"},\"inLanguage\":\"zh-Hans\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.wsisp.com\/helps\/121028.html\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.wsisp.com\/helps\/121028.html#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\u9996\u9875\",\"item\":\"https:\/\/www.wsisp.com\/helps\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668\"}]},{\"@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":"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668 - \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\/121028.html","og_locale":"zh_CN","og_type":"article","og_title":"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","og_description":"\u4ece\u4e24\u904d\u5411\u4e2d\u95f4\u904d\u5386\u6c34\u6876\u5728\u8d8a\u6765\u8d8a\u7a84\u7684\u60c5\u51b5\u4e0b\u53ea\u6709\u6362\u77ed\u677f\u624d\u6709\u53ef\u80fd\u901a\u8fc7\u589e\u52a0\u9ad8\u5ea6\u4ece\u800c\u589e\u52a0\u76db\u6c34\u91cf\u3002\u5047\u8bbe\u5de6\u77ee\u53f3\u9ad8&#xff1a;\u9762\u79ef\u7531\u5de6\u8fb9\u77ed\u677f\u51b3\u5b9a\u3002\u5982\u679c\u79fb\u52a8\u53f3\u6307\u9488&#xff0c;\u5bbd\u5ea6\u53d8\u5c0f&#xff0c;\u77ed\u677f\u8fd8\u662f\u5de6\u8fb9&#xff0c;\u9762\u79ef\u4e00\u5b9a\u4e0d\u4f1a\u66f4\u5927&#xff1b;\u53ea\u6709\u79fb\u52a8\u77ed\u677f&#xff0c;\u624d\u6709\u53ef\u80fd\u627e\u5230\u66f4\u9ad8\u7684\u6321\u677f&#xff0c;\u9762\u79ef\u53d8\u5927\u3002class Solution {public int maxArea(int[] height) {int l 0;int r height.length","og_url":"https:\/\/www.wsisp.com\/helps\/121028.html","og_site_name":"\u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","article_published_time":"2026-11-01T16:33:35+00:00","og_image":[{"url":"https:\/\/www.wsisp.com\/helps\/wp-content\/uploads\/2026\/11\/20261101163333-6ae769ddc4cb7.png"}],"author":"admin","twitter_card":"summary_large_image","twitter_misc":{"\u4f5c\u8005":"admin"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.wsisp.com\/helps\/121028.html","url":"https:\/\/www.wsisp.com\/helps\/121028.html","name":"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668 - \u7f51\u7855\u4e92\u8054\u5e2e\u52a9\u4e2d\u5fc3","isPartOf":{"@id":"https:\/\/www.wsisp.com\/helps\/#website"},"datePublished":"2026-11-01T16:33:35+00:00","dateModified":"2026-11-01T16:33:35+00:00","author":{"@id":"https:\/\/www.wsisp.com\/helps\/#\/schema\/person\/358e386c577a3ab51c4493330a20ad41"},"breadcrumb":{"@id":"https:\/\/www.wsisp.com\/helps\/121028.html#breadcrumb"},"inLanguage":"zh-Hans","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.wsisp.com\/helps\/121028.html"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/www.wsisp.com\/helps\/121028.html#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\u9996\u9875","item":"https:\/\/www.wsisp.com\/helps"},{"@type":"ListItem","position":2,"name":"LeetCode100 11. \u76db\u6700\u591a\u6c34\u7684\u5bb9\u5668"}]},{"@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\/121028","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=121028"}],"version-history":[{"count":0,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/posts\/121028\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media\/121027"}],"wp:attachment":[{"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/media?parent=121028"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/categories?post=121028"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/tags?post=121028"},{"taxonomy":"topic","embeddable":true,"href":"https:\/\/www.wsisp.com\/helps\/wp-json\/wp\/v2\/topic?post=121028"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}