Determine whether an integer is a palindrome. Do this without extra space.

我不知道说啥…刚开始用的是 str…结果说不让用额外空间,就用了…

 

然后先计算有多少位,再取出每一位进行比较…

相对较慢。暂时想不到优化办法…反转int…呵呵。

 

str方法也上一下,还是不错的。

 

【LeetCode】9. Palindrome Number
Tagged on:     
0 0 投票数
Article Rating
订阅评论
提醒

0 评论
内联反馈
查看所有评论