码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
leetcoder-50-Pow(x, n)
Pow(x, n)  可以直接用库函数pow(x,n)一步搞定,但明显这样就没意思了。 参考快速幂取模 二分,复杂度为O(logn) 递归方法 class Solution { public: double myPow(double x, int n) { if(n<0) return 1.0/myPow_1(x,-n); ...
分类:其他好文   时间:2015-07-09 18:02:45    阅读次数:92
29数组中出现次数超过一半的数字
过程: int MoreThanHalfNum(int* numbers, int length) { if (CheckInvalidArray(numbers, length)) return 0; int middle = length >> 1; int start = 0; int end = length - 1; int index = Partition(numbe...
分类:编程语言   时间:2015-07-09 18:02:10    阅读次数:136
最小的k个数
void GetLeastNumbers(int* input, int n, int* output, int k) { if (input == NULL || output == NULL || k > n || n return; int start = 0; int end = n - 1; int index = Partition(input, n, start, en...
分类:其他好文   时间:2015-07-09 18:01:10    阅读次数:156
LeetCode103 BinaryTreeZigzagLevelOrderTraversal(二叉树Z形层次遍历) Java题解
题目: Given a binary tree, return the zigzag level order traversal of its nodes' values. (ie, from left to right, then right to left for the next level and alternate between). For example: Give...
分类:编程语言   时间:2015-07-09 17:59:13    阅读次数:112
【LeetCode 222_完全二叉树_遍历】Count Complete Tree Nodes
解法一:递归int countNodes(TreeNode* root){ if (root == NULL) return 0; TreeNode *pLeft = root->left; TreeNode *pRight = root->right; ...
分类:其他好文   时间:2015-07-09 17:55:25    阅读次数:126
理解co执行逻辑
对于co的一个最简版的实现,代码如下 (https://gist.github.com/iwillwen/8488050)function co(generator) { return function(fn) { var gen = generator(); function nex...
分类:其他好文   时间:2015-07-09 17:52:04    阅读次数:123
自己写的微信公众号开发模型WeChat (回复参考weiphp)
模型:WeChatfind($mid); } /** * 处理来自微信服务器的消息 * @param $callback * @access public * @return void */ static public function pr...
分类:微信   时间:2015-07-09 17:43:48    阅读次数:480
防止界面卡顿
void DoEvents(){ MSG msg; // Process existing messages in the application's message queue. // When the queue is empty, do clean up and return...
分类:其他好文   时间:2015-07-09 17:32:25    阅读次数:105
OC调用Swift
修改main.m文件 #import #import "Root.h" int main(int argc, const char * argv[]) { @autoreleasepool { Root *rt = [[Root alloc] init]; [rt desc]; } return 0; } OC文件:Root....
分类:编程语言   时间:2015-07-09 16:15:42    阅读次数:122
28.字符串的排列
void Permutation(char*  pStr) { if (pStr == NULL) return; Permutation(pStr, pStr); } void Permutation(char* pStr, char* pBegin) { if (*pBegin == '\0') { printf("%s\n", pStr); } else { fo...
分类:其他好文   时间:2015-07-09 16:09:51    阅读次数:120
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!