math
jerseyma
这个作者很懒,什么都没留下…
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
[Leetcode]#166 Fraction to Recurring Decimal
Given two integers representing the numerator and denominator of a fraction, return the fraction in string format.If the fractional part is repeating, enclose the repeating part in parentheses.For exam原创 2015-09-02 07:50:47 · 229 阅读 · 0 评论 -
[Leetcode]#231 Power of Two
//#231 Power of Two//8ms 98.07%class Solution {public: bool isPowerOfTwo(int n) { int m = n & (n-1); return ( (n > 0) && (m == 0) ); }};原创 2015-09-02 08:09:10 · 299 阅读 · 0 评论 -
[Leetcode]#50 Pow(x, n)
//#50 Pow(x, n)//4ms 100%class Solution {public: double myPow(double x, int n) { if (n < 0) return 1.0 / pow(x, -n); else return pow(x, n); } double pow(double x, int原创 2015-09-02 07:01:48 · 247 阅读 · 0 评论 -
[Leetcode]#69 Sqrt(x)
//#69 Sqrt(x)//8ms 100%class Solution {public: int mySqrt(int x) { //x is guarantted to be valid //x has to be equal or larger than 0 if(x == 0) return 0; if原创 2015-09-02 07:13:00 · 286 阅读 · 0 评论 -
[Leetcode]#7 Reverse Integer
//#7 Reverse Integer//8ms 100%class Solution {public: int reverse(int x) { if(x == -2147483648) return 0; bool positive(true); if(x < 0) { posi原创 2015-09-02 06:28:37 · 279 阅读 · 0 评论 -
[Leetcode]#171 Excel Sheet Column Number
//#171 Excel Sheet Column Number//8ms 100%class Solution {public: int titleToNumber(string s) { int s_num(0); int j(0); for(string::reverse_iterator r_it = s.rbegin(原创 2015-09-02 07:54:44 · 341 阅读 · 0 评论 -
[Leetcode]#8 String to Integer (atoi)
//#8 String to Integer (atoi)//8ms 100%class Solution {public: int myAtoi(string str) { int result(0); bool negative(false); bool start(false); for(string::i原创 2015-09-02 06:30:18 · 332 阅读 · 0 评论 -
[Leetcode]#168 Excel Sheet Column Title
//#168 Excel Sheet Column Title//0ms 100%class Solution {public: string convertToTitle(int n) { string result; int remainder(0); while(n!=0) { re原创 2015-09-02 07:52:15 · 371 阅读 · 0 评论 -
[Leetcode]#223 Rectangle Area
//#223 Rectangle Area//32ms 98.98%class Solution {public: int computeArea(int A, int B, int C, int D, int E, int F, int G, int H) { int c1(0), c2(0), c3(0), c4(0); if(A>=E)原创 2015-09-02 08:04:42 · 337 阅读 · 0 评论
分享