目录
LeetCode 246 (Easy):判断一个数是否为中心对称数
LeetCode 247 (Medium):给出长度为 n 的所有中心对称数
LeetCode 248 (Hard):求给定区间内有多少中心对称数
-
LeetCode 246 (Easy):判断一个数是否为中心对称数
A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).
Write a function to determine if a number is strobogrammatic. The number is represented as a string.
Examples:
Input: "69" Output: true
Input: "88" Output: true
Input: "962" Output: false
解答:
两个数字只有这5种情况满足中心对称:11,88, 00, 69,96。可以看做求回文数的一种特殊情况,用双指针。
参考代码:https://www.cnblogs.com/grandyang/p/5196960.html
-
LeetCode 247 (Medium):给出长度为 n 的所有中心对称数
A strobogrammatic number is a number tha