上一页 1 ··· 7 8 9 10 11
摘要: 刷LeetCode的时候经常要解决越界的问题,比如INT_MIN取绝对值就越界了,所以知道没种类型的最小值及最大值很有必要。long和int一般都是4字节,但是long在32位系统和64位系统不同,但我自己电脑64位win 8.1测试还是4个字节,可能和VS的设置也有关系。所以解决越界问题用long... 阅读全文
posted @ 2015-08-17 16:10 Sean_le 阅读(314) 评论(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 阅读(211) 评论(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 阅读(339) 评论(0) 推荐(0) 编辑
摘要: 今天在刷Multiply Strings一题时,一直出现runtime error,找了很久都没找到问题。找了一个小时,是在扛不住了,问师兄了,一眼看出问题是new int(len1)这儿出了问题,导致数组越界了。创建一个数组是int *array=new int[length],创建一个长度为le... 阅读全文
posted @ 2015-08-16 20:54 Sean_le 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Multiply StringsGiven two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large ... 阅读全文
posted @ 2015-08-16 20:39 Sean_le 阅读(133) 评论(0) 推荐(0) 编辑
摘要: Basic CalculatorImplement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), t... 阅读全文
posted @ 2015-08-16 17:02 Sean_le 阅读(163) 评论(0) 推荐(0) 编辑
摘要: Number of Digit OneGiven an integer n, count the total number of digit 1 appearing in all non-negative integers less than or equal to n.For example:Gi... 阅读全文
posted @ 2015-08-16 13:27 Sean_le 阅读(164) 评论(0) 推荐(0) 编辑
摘要: Permutation SequenceThe set[1,2,3,…,n]contains a total ofn! unique permutations.By listing and labeling all of the permutations in order,We get the fo... 阅读全文
posted @ 2015-08-15 15:27 Sean_le 阅读(140) 评论(0) 推荐(0) 编辑
上一页 1 ··· 7 8 9 10 11