摘要: Add DigitsGiven a non-negative integernum, repeatedly add all its digits until the result has only one digit.For example:Givennum = 38, the process is... 阅读全文
posted @ 2015-08-17 16:59 Sean_le 阅读(173) 评论(0) 推荐(0)
摘要: 刷LeetCode的时候经常要解决越界的问题,比如INT_MIN取绝对值就越界了,所以知道没种类型的最小值及最大值很有必要。long和int一般都是4字节,但是long在32位系统和64位系统不同,但我自己电脑64位win 8.1测试还是4个字节,可能和VS的设置也有关系。所以解决越界问题用long... 阅读全文
posted @ 2015-08-17 16:10 Sean_le 阅读(321) 评论(0) 推荐(0)
摘要: Happy NumberWrite an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Starting with any posi... 阅读全文
posted @ 2015-08-17 15:52 Sean_le 阅读(220) 评论(0) 推荐(0)
摘要: Fraction to Recurring DecimalGiven two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the ... 阅读全文
posted @ 2015-08-17 15:48 Sean_le 阅读(343) 评论(0) 推荐(0)