1 bool isPowerOfTwo(int n)2 {3 return n > 0 && !(n & (n - 1));4 }
分类:
其他好文 时间:
2015-07-06 11:49:07
阅读次数:
80
一 : 简单工厂模式Python:class Operation : def GetResult(self): passclass OpertationAdd(Operation): def GetResult(self,o1,o2): return o1+02class OperationDi.....
分类:
其他好文 时间:
2015-07-06 11:41:54
阅读次数:
96
#endregion #region Json字符串转换为DataTable 实例方法 public DataTable JsonToDataTable(json) { DataTable dt= ToDataTable(json); return...
分类:
Web程序 时间:
2015-07-06 10:06:18
阅读次数:
146
这道题有两个思路, 一是沿用085的maximum rectangle的思路, 稍作改进即可, 代码如下, 这个方法运行192msclass Solution: # @param {character[][]} matrix # @return {integer} def maxi...
分类:
其他好文 时间:
2015-07-06 08:51:45
阅读次数:
136
Just one line. Bit-wise ops:class Solution {public: bool isPowerOfTwo(int n) { return (n > 0) && (n & (n - 1)) == 0; }};
分类:
其他好文 时间:
2015-07-06 07:45:25
阅读次数:
115
Given a binary tree, return thelevel ordertraversal of its nodes' values. (ie, from left to right, level by level).For example:Given binary tree{3,9,2...
分类:
编程语言 时间:
2015-07-06 06:37:44
阅读次数:
125
1 class Solution { 2 public: 3 /** 4 * @param s: A string 5 * @param p: A string includes "." and "*" 6 * @return: A boolean 7 ...
分类:
其他好文 时间:
2015-07-06 01:18:01
阅读次数:
338
题意:如标题思路:其他文章已经写过,参考其他。1 class Solution {2 public:3 int trailingZeroes(int n) {4 return n/5<5? n/5: n/5+trailingZeroes(n/5);5 }6 };AC代...
分类:
其他好文 时间:
2015-07-05 23:54:10
阅读次数:
170
跳转语句:break;跳出的意思,如果在循环语句中使用则是跳出循环default,通常与 switch case 配合使用continue继续return返回值异常语句:try-catch-finally保护程序,在出错的情况下也不会终止try //快捷键:try后双击Tab键{ 要执行的代码...
分类:
其他好文 时间:
2015-07-05 23:43:29
阅读次数:
166
Add Binary
Total Accepted: 46815
Total Submissions: 189215
My Submissions
Given two binary strings, return their sum (also a binary string).
For example,
a =...
分类:
其他好文 时间:
2015-07-05 22:35:34
阅读次数:
228