码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
LeetCode Invert Binary Tree
LeetCode Invert Binary Tree题目思路没什么思路可言; 真不敢相信他写不出;代码struct TreeNode* invertTree(struct TreeNode* root) { if (root == NULL) return root; invertTree(root->left); invertTree(root->right);...
分类:其他好文   时间:2015-06-13 11:27:30    阅读次数:234
LeetCode Rectangle Area
LeetCode Rectangle Area题目思路刚开始自己写别提WA多少遍了; 后来看到标达真的被惊讶到了; 代码可以这么美;代码自己的#define min(A, B) (A > B ? B : A)bool pointInRectangle(int px, int py, int ax, int ay, int bx, int by) { return ax <= px &&...
分类:其他好文   时间:2015-06-13 11:26:51    阅读次数:276
Leetcode[145]-Binary Tree Postorder Traversal
Given a binary tree, return the postorder traversal of its nodes’ values.For example: Given binary tree {1,#,2,3}, 1 2 / 3return [3,2,1].Note: Recursive solution is trivial, could...
分类:其他好文   时间:2015-06-13 11:23:14    阅读次数:113
Leetcode[102]-Binary Tree Level Order Traversal
Given a binary tree, return the level order traversal of its nodes’ values. (ie, from left to right, level by level).For example: Given binary tree {3,9,20,#,#,15,7}, 3 / 9 20 / 1...
分类:其他好文   时间:2015-06-13 11:20:46    阅读次数:114
Leetcode[]-Binary Search Tree Iterator
Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST.Calling next() will return the next smallest number in the BST.Note: next() and hasN...
分类:其他好文   时间:2015-06-13 09:56:01    阅读次数:100
php操作mysqli(示例代码)
$name) return $this->$name; return null; } public function connect($host,$user,$pass,$db,$charSet='utf8',$force=false) { if($this->db && ($this-...
分类:数据库   时间:2015-06-13 06:18:35    阅读次数:229
IOS程序启动过程
程序的启动过程:main函数中执行了一个UIApplicationMain这个函数int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFrom...
分类:移动开发   时间:2015-06-13 06:18:28    阅读次数:180
50 Pow(x, n)(求x的n次方Medium)
题目意思:x为double,n为int,求x的n次方思路分析:直接求,注意临界条件 1 class Solution { 2 public: 3 double myPow(double x, int n) { 4 if(x==1.0)return x; 5 e...
分类:其他好文   时间:2015-06-13 06:16:35    阅读次数:121
Leetcode[7]-Reverse Integer
Reverse digits of an integer.Example1: x = 123, return 321 Example2: x = -123, return -321取一个数的最后一位,用x % 10,取一个数的前n-1位(共n位),用x/10,每一次取的时候,都将上一次取的数乘以10,然后再加上末尾的数即可,代码如下:Code(C++)class Solution { public...
分类:其他好文   时间:2015-06-12 23:55:44    阅读次数:178
全排列算法
废话不多说,直接上代码#include #define swap(a,b){long temp=*a;*a=*b;*b=temp;}void Permutation(char* pStr, char* pBegin){ if(!pStr || !pBegin) return; ...
分类:编程语言   时间:2015-06-12 23:49:51    阅读次数:184
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!