Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-08-04 02:01:23
阅读次数:
93
def summary_ranges(nums) summary = []; if nums.size == 0 return summary end if nums.size == 1 return summary #{nums[i - 1]}"...
分类:
编程语言 时间:
2015-08-04 00:32:33
阅读次数:
105
题目 :Reverse IntegerReverse digits of an integer.Example1:x = 123, return 321Example2:x = -123, return -321题目分析及部分代码解析:1、需要考虑一位数,比如1,2,3等特殊情况,返回本身。2、需要...
分类:
其他好文 时间:
2015-08-04 00:24:22
阅读次数:
163
Given two strings s and t, write a function to determine if t is an anagram of s.
For example,
s = "anagram", t = "nagaram", return true.
s = "rat", t = "car", return false.
Note:
You may a...
分类:
其他好文 时间:
2015-08-03 22:54:11
阅读次数:
142
int CompTree(TreeNode *tree1, TreeNode *tree2)
{
bool isTree1Null = (tree1 == NULL);
bool isTree2Null = (tree2 == NULL);
//其中一个为NULL,而另一个不为NULL,肯定不相等
if (isTree1Null != isTree2Null)
return 1;
/...
分类:
其他好文 时间:
2015-08-03 22:39:37
阅读次数:
302
Given a range [m, n] where 0 m 1101 11111111 –>n 可以去掉的就是n的分割部分的1。 所以结果其实就是m和n公共头部*/ int res=0; if(m==0)return 0; ...
分类:
其他好文 时间:
2015-08-03 22:19:51
阅读次数:
197
Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can see ordered from top to bottom.For exampl...
分类:
其他好文 时间:
2015-08-03 22:18:49
阅读次数:
105
1:方法(掌握)(1)方法:就是完成特定功能的代码块。注意:在很多语言里面有函数的定义,而在Java中,函数被称为方法。 (2)格式: 修饰符 返回值类型 方法名(参数类型 参数名1,参数类型 参数名2...) { 方法体语句; return 返回值; } 修饰符:目前就用 publi...
分类:
编程语言 时间:
2015-08-03 22:16:56
阅读次数:
171
Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as00000010100101000001111010011100), return ...
分类:
其他好文 时间:
2015-08-03 22:14:10
阅读次数:
172
思路很简单,出口是空节点,先翻转子节点,再返回。TreeNode* invertTree(TreeNode* root) { if (root == nullptr){ return root; } invertTree(root->left); ...
分类:
其他好文 时间:
2015-08-03 20:54:19
阅读次数:
129