摘要:
Add Digits: Given a non-negative integer num, repeatedly add all its digits until the result has only one digit. For example: Given num = 38, the proc... 阅读全文
posted @ 2016-01-11 19:40
Lewisr
阅读(128)
评论(0)
推荐(0)
摘要:
Reverse Integer:Reverse digits of an integer. Example1: x = 123, return 321Example2: x = -123, return –321 题意:反转整数,不改变正负号。 思路: 逐步对给定的整数进行取余和求整,初始化最初的结果为result=0,然后result = result * 10 + 余数。最后注意判断是否溢出... 阅读全文
posted @ 2016-01-11 19:28
Lewisr
阅读(107)
评论(0)
推荐(0)

浙公网安备 33010602011771号