{"id":2773,"date":"2020-01-14T10:07:06","date_gmt":"2020-01-14T02:07:06","guid":{"rendered":"http:\/\/www.sniper97.cn\/?p=2773"},"modified":"2020-01-14T10:07:06","modified_gmt":"2020-01-14T02:07:06","slug":"%e3%80%90leetcode%e3%80%910009-%e5%9b%9e%e6%96%87%e6%95%b0","status":"publish","type":"post","link":"http:\/\/www.sniper97.cn\/index.php\/note\/algorithm\/2773\/","title":{"rendered":"\u3010LeetCode\u30110009 \u56de\u6587\u6570"},"content":{"rendered":"\n<p><a href=\"https:\/\/leetcode-cn.com\/problems\/palindrome-number\">https:\/\/leetcode-cn.com\/problems\/palindrome-number<\/a><\/p>\n\n\n<p>\u4ee3\u7801\uff1a<\/p>\n\n\n<pre class=\"wp-block-preformatted\"># -*- coding:utf-8 -*-<br \/>class Solution(object):<br \/>    def isPalindrome(self, x):<br \/>        <em>\"\"\"<br \/><\/em><em>        <\/em><strong><em>:type<\/em><\/strong><em> x: int<br \/><\/em><em>        <\/em><strong><em>:rtype<\/em><\/strong><em>: bool<br \/><\/em><em>        \"\"\"<br \/><\/em><em>        <\/em>if x &lt; 0:<br \/>            return False<br \/>        str_x = str(x)<br \/>        if str_x == str_x[::-1]:<br \/>            return True<br \/>        else:<br \/>            return False<br \/><br \/><br \/>if __name__ == '__main__':<br \/>    i = 1210<br \/>    print(Solution().isPalindrome(i))<br \/><\/pre>\n\n\n<p><strong>\u601d\u8def<\/strong>\uff1a\u8fd9\u9053\u9898\u6ca1\u5565\u53ef\u8bf4\u7684\uff0c\u633a\u7b80\u5355\u7684\uff0c\u76f4\u63a5\u5b57\u7b26\u4e32\u7ffb\u8f6c\u5224\u65ad\u4e00\u4e0d\u4e00\u6837\u5c31\u884c\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>https:\/\/leetcode-cn.com\/problems\/palindrome-number [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_mi_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"views":1288,"_links":{"self":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/2773"}],"collection":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/comments?post=2773"}],"version-history":[{"count":0,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/posts\/2773\/revisions"}],"wp:attachment":[{"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/media?parent=2773"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/categories?post=2773"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/www.sniper97.cn\/index.php\/wp-json\/wp\/v2\/tags?post=2773"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}