{"id":2603,"date":"2022-02-04T13:41:07","date_gmt":"2022-02-04T05:41:07","guid":{"rendered":"http:\/\/139.9.1.231\/?p=2603"},"modified":"2022-02-04T13:41:08","modified_gmt":"2022-02-04T05:41:08","slug":"leetcodeday125","status":"publish","type":"post","link":"http:\/\/139.9.1.231\/index.php\/2022\/02\/04\/leetcodeday125\/","title":{"rendered":"leetcodeday125&#8211;\u9a8c\u8bc1\u56de\u6587\u4e32"},"content":{"rendered":"\n<p>\u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u9a8c\u8bc1\u5b83\u662f\u5426\u662f\u56de\u6587\u4e32\uff0c\u53ea\u8003\u8651\u5b57\u6bcd\u548c\u6570\u5b57\u5b57\u7b26\uff0c\u53ef\u4ee5\u5ffd\u7565\u5b57\u6bcd\u7684\u5927\u5c0f\u5199\u3002<\/p>\n\n\n\n<p><strong>\u8bf4\u660e\uff1a<\/strong>\u672c\u9898\u4e2d\uff0c\u6211\u4eec\u5c06\u7a7a\u5b57\u7b26\u4e32\u5b9a\u4e49\u4e3a\u6709\u6548\u7684\u56de\u6587\u4e32\u3002<\/p>\n\n\n\n<p><strong>\u793a\u4f8b 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165:<\/strong> \"A man, a plan, a canal: Panama\"\n<strong>\u8f93\u51fa:<\/strong> true\n<strong>\u89e3\u91ca\uff1a<\/strong>\"amanaplanacanalpanama\" \u662f\u56de\u6587\u4e32<\/code><\/pre>\n\n\n\n<p><strong>\u793a\u4f8b 2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code><strong>\u8f93\u5165:<\/strong> \"race a car\"\n<strong>\u8f93\u51fa:<\/strong> false\n<strong>\u89e3\u91ca\uff1a<\/strong>\"raceacar\" \u4e0d\u662f\u56de\u6587\u4e32<\/code><\/pre>\n\n\n\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n\n\n\n<ul><li><code>1 &lt;= s.length &lt;= 2 * 10<sup>5<\/sup><\/code><\/li><li>\u5b57\u7b26\u4e32&nbsp;<code>s<\/code>&nbsp;\u7531 ASCII \u5b57\u7b26\u7ec4\u6210<\/li><\/ul>\n\n\n\n<pre class=\"wp-block-code\"><code># @lc app=leetcode.cn id=125 lang=python3\r\n#\r\n# &#91;125] \u9a8c\u8bc1\u56de\u6587\u4e32\r\n#\r\n\r\n# @lc code=start\r\nclass Solution:\r\n    def isPalindrome(self, s: str) -> bool:\r\n        s=''.join(list(filter(str.isalnum,  s))).lower()\r\n        \r\n        print(s)\r\n        i=0\r\n        j=len(s)-1\r\n        while i&lt;=j:\r\n            if s&#91;i]==s&#91;j]:\r\n                i+=1\r\n                j-=1\r\n            else:\r\n                return False\r\n        return True\r\n\r\n# @lc code=end\r\n<\/code><\/pre>\n\n\n\n<figure class=\"wp-block-image size-full is-style-default\"><img loading=\"lazy\" width=\"799\" height=\"269\" src=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-35.png\" alt=\"\" class=\"wp-image-2604\" srcset=\"http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-35.png 799w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-35-300x101.png 300w, http:\/\/139.9.1.231\/wp-content\/uploads\/2022\/02\/image-35-768x259.png 768w\" sizes=\"(max-width: 799px) 100vw, 799px\" \/><\/figure>\n","protected":false},"excerpt":{"rendered":"<p>\u7ed9\u5b9a\u4e00\u4e2a\u5b57\u7b26\u4e32\uff0c\u9a8c\u8bc1\u5b83\u662f\u5426\u662f\u56de\u6587\u4e32\uff0c\u53ea\u8003\u8651\u5b57\u6bcd\u548c\u6570\u5b57\u5b57\u7b26\uff0c\u53ef\u4ee5\u5ffd\u7565\u5b57\u6bcd\u7684\u5927\u5c0f\u5199\u3002 \u8bf4\u660e\uff1a\u672c\u9898\u4e2d\uff0c\u6211\u4eec\u5c06\u7a7a\u5b57\u7b26\u4e32 &hellip; <a href=\"http:\/\/139.9.1.231\/index.php\/2022\/02\/04\/leetcodeday125\/\" class=\"more-link\">\u7ee7\u7eed\u9605\u8bfb<span class=\"screen-reader-text\">leetcodeday125&#8211;\u9a8c\u8bc1\u56de\u6587\u4e32<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[6],"tags":[],"_links":{"self":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2603"}],"collection":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/comments?post=2603"}],"version-history":[{"count":1,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2603\/revisions"}],"predecessor-version":[{"id":2605,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/posts\/2603\/revisions\/2605"}],"wp:attachment":[{"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/media?parent=2603"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/categories?post=2603"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/139.9.1.231\/index.php\/wp-json\/wp\/v2\/tags?post=2603"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}