摘要:
Determine whether an integer is a palindrome. Do this without extra space.---public class Solution { public boolean isPalindrome(int x) { if(x = 10){ div *= 10; } while(x > 0){ int l = x / div; int r = x % 10; if(l !... 阅读全文
posted @ 2013-08-30 00:50
LEDYC
阅读(157)
评论(0)
推荐(0)
摘要:
Implementatoito convert a string to an integer.Hint:Carefully consider all possible input cases. If you want a challenge, please do not see below and ask yourself what are the possible input cases.Notes:It is intended for this problem to be specified vaguely (ie, no given input specs). You are respo 阅读全文
posted @ 2013-08-30 00:09
LEDYC
阅读(224)
评论(0)
推荐(0)
摘要:
Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321---public class Solution { public int reverse(int x) { boolean sign = x >=0; if(x 0){ int i = x % 10; rst = rst * 10 + i; x = x / 10; } ... 阅读全文
posted @ 2013-08-30 00:03
LEDYC
阅读(132)
评论(0)
推荐(0)
浙公网安备 33010602011771号