摘要: Given an integer, write a function to determine if it is a power of two.Solution:一个整数如果是2的整数次方,那么它的二进制表示中有且只有一位是1,而其他所有位都是0。把这个整数与这个整数减去1之后进行与运算,那么这个整... 阅读全文
posted @ 2015-07-27 23:04 irun 阅读(108) 评论(0) 推荐(0) 编辑
摘要: Given a stringsconsists of upper/lower-case alphabets and empty space characters' ', return the length of last word in the string.If the last word doe... 阅读全文
posted @ 2015-07-27 22:49 irun 阅读(117) 评论(0) 推荐(0) 编辑
摘要: 7 - Reverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321Notice:1.If the integer's last digit is 0, what should the ... 阅读全文
posted @ 2015-07-27 21:45 irun 阅读(159) 评论(0) 推荐(0) 编辑