{"id":9800,"date":"2022-09-07T22:11:22","date_gmt":"2022-09-08T05:11:22","guid":{"rendered":"https:\/\/zxi.mytechroad.com\/blog\/?p=9800"},"modified":"2022-09-07T22:11:35","modified_gmt":"2022-09-08T05:11:35","slug":"leetcode-2396-strictly-palindromic-number%ef%bf%bc%ef%bf%bc","status":"publish","type":"post","link":"https:\/\/zxi.mytechroad.com\/blog\/math\/leetcode-2396-strictly-palindromic-number%ef%bf%bc%ef%bf%bc\/","title":{"rendered":"\u82b1\u82b1\u9171 LeetCode 2396.\u00a0Strictly Palindromic Number"},"content":{"rendered":"\n<p>An integer&nbsp;<code>n<\/code>&nbsp;is&nbsp;<strong>strictly palindromic<\/strong>&nbsp;if, for&nbsp;<strong>every<\/strong>&nbsp;base&nbsp;<code>b<\/code>&nbsp;between&nbsp;<code>2<\/code>&nbsp;and&nbsp;<code>n - 2<\/code>&nbsp;(<strong>inclusive<\/strong>), the string representation of the integer&nbsp;<code>n<\/code>&nbsp;in base&nbsp;<code>b<\/code>&nbsp;is&nbsp;<strong>palindromic<\/strong>.<\/p>\n\n\n\n<p>Given an integer&nbsp;<code>n<\/code>, return&nbsp;<code>true<\/code>&nbsp;<em>if&nbsp;<\/em><code>n<\/code><em>&nbsp;is&nbsp;<strong>strictly palindromic<\/strong>&nbsp;and&nbsp;<\/em><code>false<\/code><em>&nbsp;otherwise<\/em>.<\/p>\n\n\n\n<p>A string is&nbsp;<strong>palindromic<\/strong>&nbsp;if it reads the same forward and backward.<\/p>\n\n\n\n<p><strong>Example 1:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted;crayon:false\"><strong>Input:<\/strong> n = 9\n<strong>Output:<\/strong> false\n<strong>Explanation:<\/strong> In base 2: 9 = 1001 (base 2), which is palindromic.\nIn base 3: 9 = 100 (base 3), which is not palindromic.\nTherefore, 9 is not strictly palindromic so we return false.\nNote that in bases 4, 5, 6, and 7, n = 9 is also not palindromic.\n<\/pre>\n\n\n\n<p><strong>Example 2:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted;crayon:false\"><strong>Input:<\/strong> n = 4\n<strong>Output:<\/strong> false\n<strong>Explanation:<\/strong> We only consider base 2: 4 = 100 (base 2), which is not palindromic.\nTherefore, we return false.\n<\/pre>\n\n\n\n<p><strong>Constraints:<\/strong><\/p>\n\n\n\n<ul class=\"wp-block-list\"><li><code>4 &lt;= n &lt;= 10<sup>5<\/sup><\/code><\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\"><strong>Solution: Just return false<\/strong><\/h2>\n\n\n\n<p>No such number.<\/p>\n\n\n\n<p>Time complexity: O(1)<br>Space complexity: O(1)<\/p>\n\n\n\n<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">C++<\/h2>\n<div class=\"tabcontent\">\n\n<pre lang=\"c++\">\/\/ Author: Huahua\nclass Solution {\npublic:\n  bool isStrictlyPalindromic(int n) {\n    return false;\n  }\n};\n<\/pre>\n<\/div><\/div>\n","protected":false},"excerpt":{"rendered":"<p>An integer&nbsp;n&nbsp;is&nbsp;strictly palindromic&nbsp;if, for&nbsp;every&nbsp;base&nbsp;b&nbsp;between&nbsp;2&nbsp;and&nbsp;n &#8211; 2&nbsp;(inclusive), the string representation of the integer&nbsp;n&nbsp;in base&nbsp;b&nbsp;is&nbsp;palindromic. Given an integer&nbsp;n, return&nbsp;true&nbsp;if&nbsp;n&nbsp;is&nbsp;strictly palindromic&nbsp;and&nbsp;false&nbsp;otherwise. A string is&nbsp;palindromic&nbsp;if it reads the same&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[49],"tags":[31,177,720],"class_list":["post-9800","post","type-post","status-publish","format-standard","hentry","category-math","tag-math","tag-medium","tag-proof","entry","simple"],"_links":{"self":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/9800","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/comments?post=9800"}],"version-history":[{"count":2,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/9800\/revisions"}],"predecessor-version":[{"id":9802,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/posts\/9800\/revisions\/9802"}],"wp:attachment":[{"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/media?parent=9800"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/categories?post=9800"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zxi.mytechroad.com\/blog\/wp-json\/wp\/v2\/tags?post=9800"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}