• 博客园logo
  • 会员
  • 众包
  • 新闻
  • 博问
  • 闪存
  • 赞助商
  • HarmonyOS
  • Chat2DB
    • 搜索
      所有博客
    • 搜索
      当前博客
  • 写随笔 我的博客 短消息 简洁模式
    用户头像
    我的博客 我的园子 账号设置 会员中心 简洁模式 ... 退出登录
    注册 登录
刻舟求剑,终日乾乾
博客园 | 首页 | 新随笔 | 新文章 | 联系 | 订阅 订阅 | 管理

2015年5月9日

LeetCode题解(9)--Palindrome Number
摘要: Determine whether an integer is a palindrome. Do this without extra space. 思想: 先计算出这个整数的逆序数,然后比较它和原来的数每位是否都相同即可。另外要注意负数没有回文数,还应该考虑overflow一定不是回文数。 AC代 阅读全文
posted @ 2015-05-09 17:19 aezero 阅读(179) 评论(0) 推荐(0)
 
LeetCode题解(8)--String to Integer (atoi)
摘要: Implement atoi to convert a string to an integer. Hint: Carefully consider all possible input cases. If you want a challenge, please do not see below 阅读全文
posted @ 2015-05-09 17:06 aezero 阅读(256) 评论(0) 推荐(0)
 
LeetCode题解(7)--Reverse Integer
摘要: Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return -321 思想:一个整数的倒序,没啥说的,在long类型上比较来避免overflow。 AC代码: 1 class Soluti 阅读全文
posted @ 2015-05-09 16:23 aezero 阅读(167) 评论(0) 推荐(0)
 
 

公告


博客园  ©  2004-2025
浙公网安备 33010602011771号 浙ICP备2021040463号-3