[LeetCode] Find the Closest Palindrome 寻找最近的回文串
Posted Grandyang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了[LeetCode] Find the Closest Palindrome 寻找最近的回文串相关的知识,希望对你有一定的参考价值。
Given an integer n, find the closest integer (not including itself), which is a palindrome.
The ‘closest‘ is defined as absolute difference minimized between two integers.
Example 1:
Input: "123" Output: "121"
Note:
- The input n is a positive integer represented by string, whose length will not exceed 18.
- If there is a tie, return the smaller one as answer.
s
以上是关于[LeetCode] Find the Closest Palindrome 寻找最近的回文串的主要内容,如果未能解决你的问题,请参考以下文章
LeetCode: Find the Duplicate Number
LeetCode 997. Find the Town Judge
LeetCode 389. Find the Difference