码迷,mamicode.com
首页 > 其他好文 > 详细

[LeetCode] Find the Closest Palindrome 寻找最近的回文串

时间:2017-05-28 12:28:00      阅读:229      评论:0      收藏:0      [点我收藏+]

标签:efi   min   cee   one   which   osi   elf   find   tco   

 

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:

  1. The input n is a positive integer represented by string, whose length will not exceed 18.
  2. If there is a tie, return the smaller one as answer.

 

s

 

[LeetCode] Find the Closest Palindrome 寻找最近的回文串

标签:efi   min   cee   one   which   osi   elf   find   tco   

原文地址:http://www.cnblogs.com/grandyang/p/6915355.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!