{"id":4158,"date":"2023-11-06T10:09:36","date_gmt":"2023-11-06T02:09:36","guid":{"rendered":"https:\/\/white-night.club\/?p=4158"},"modified":"2023-11-09T11:07:42","modified_gmt":"2023-11-09T03:07:42","slug":"ad133","status":"publish","type":"post","link":"https:\/\/white-night.club\/index.php\/2023\/11\/06\/ad133\/","title":{"rendered":"1446.\u00a0\u8fde\u7eed\u5b57\u7b26"},"content":{"rendered":"\n<p>\u7ed9\u4f60\u4e00\u4e2a\u5b57\u7b26\u4e32\u00a0<code>s<\/code>\u00a0\uff0c\u5b57\u7b26\u4e32\u7684<strong>\u300c\u80fd\u91cf\u300d<\/strong>\u5b9a\u4e49\u4e3a\uff1a\u53ea\u5305\u542b\u4e00\u79cd\u5b57\u7b26\u7684\u6700\u957f\u975e\u7a7a\u5b50\u5b57\u7b26\u4e32\u7684\u957f\u5ea6\u3002<\/p>\n\n\n\n<p>\u8bf7\u4f60\u8fd4\u56de\u5b57\u7b26\u4e32&nbsp;<code>s<\/code>&nbsp;\u7684&nbsp;<strong>\u80fd\u91cf<\/strong>\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>s = \"leetcode\"\n<strong>\u8f93\u51fa\uff1a<\/strong>2\n<strong>\u89e3\u91ca\uff1a<\/strong>\u5b50\u5b57\u7b26\u4e32 \"ee\" \u957f\u5ea6\u4e3a 2 \uff0c\u53ea\u5305\u542b\u5b57\u7b26 'e' \u3002\n<\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2\uff1a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><strong>\u8f93\u5165\uff1a<\/strong>s = \"abbcccddddeeeeedcba\"\n<strong>\u8f93\u51fa\uff1a<\/strong>5\n<strong>\u89e3\u91ca\uff1a<\/strong>\u5b50\u5b57\u7b26\u4e32 \"eeeee\" \u957f\u5ea6\u4e3a 5 \uff0c\u53ea\u5305\u542b\u5b57\u7b26 'e' \u3002\n<\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul>\n<li><code>1 &lt;= s.length &lt;= 500<\/code><\/li>\n\n\n\n<li><code>s<\/code>&nbsp;\u53ea\u5305\u542b\u5c0f\u5199\u82f1\u6587\u5b57\u6bcd\u3002<\/li>\n<\/ul>\n\n\n\n<div style=\"height:60px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<blockquote class=\"wp-block-quote has-luminous-vivid-amber-color has-text-color\">\n<p>\u89e3\u9898\u601d\u8def<\/p>\n<cite><em>\u6478\u9c7c\u9898<\/em><\/cite><\/blockquote>\n\n\n\n<p>\u6478\u4e2a\u9c7c\u5148\uff0c\u4e0d\u60f3\u5237\u65b0\u9898\u90a3\u5c31\u5237\u70b9\u7b80\u5355\u9898\u4fdd\u6301\u4e0b\u624b\u611f\u4e86\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Solution {\r\npublic:\r\n    int maxPower(string s) {\r\n        int result=1;\r\n        int tmp=1;\r\n        int len=s.length();\r\n        char cur=s&#91;0];\r\n        for(int i=1;i&lt;len;i++)\r\n        {\r\n            \r\n            if(cur==s&#91;i])\r\n            {\r\n                tmp++;\r\n                if(result&lt;tmp)\r\n                    result=tmp;\r\n            }else{\r\n                tmp=1;\r\n                cur=s&#91;i];\r\n            }\r\n        }\r\n        return result;\r\n    }\r\n};<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>Leetcode\u9898\u76ee\uff1a\u6478\u9c7c\u9898<\/p>\n","protected":false},"author":1,"featured_media":2827,"comment_status":"open","ping_status":"","sticky":false,"template":"base","format":"standard","meta":{"footnotes":""},"categories":[42,25],"tags":[38],"_links":{"self":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/4158"}],"collection":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/comments?post=4158"}],"version-history":[{"count":0,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/posts\/4158\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media\/2827"}],"wp:attachment":[{"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/media?parent=4158"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/categories?post=4158"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/white-night.club\/index.php\/wp-json\/wp\/v2\/tags?post=4158"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}