闭包的理解所谓“闭包”,指的是一个拥有许多变量和绑定了这些变量的环境的表达式(通常是一个函数),因而这些变量也是该表达式的一部分。下面来看一个例子:function a(){ var tmp=1; return function a_sub(x){ alert(x...
分类:
Web程序 时间:
2015-07-27 01:55:13
阅读次数:
165
#include<stdio.h>intmain(){inta,b,c;a=9;b=3;c=a+b;printf("%d+%d=%d\n",a,b,c);c=a-b;printf("%d-%d=%d\n",a,b,c);c=a*b;printf("%d*%d=%d\n",a,b,c);c=a/b;printf("%d/%d=%d\n",a,b,c);return0;}
分类:
编程语言 时间:
2015-07-27 00:36:33
阅读次数:
151
斐波那契数列递归实现/**
* @author 韦轩
* @time 2015/07/26
* @brief 递归求菲波那切数列的第N项
* @param n,无符号的整数,要求的第N项
* @return 返回第N项
*
*/
long long getNthNumberWithRecursion(unsigned int n)
{
int result[2] = { 0...
分类:
其他好文 时间:
2015-07-27 00:23:13
阅读次数:
240
#include#include#include#include#includeusing namespace std;char str[300];double ans;double chcd(char x){ return (x-'0')*1.0;}double ch(int l,int r...
分类:
其他好文 时间:
2015-07-27 00:16:04
阅读次数:
138
Given a binary tree, return theinordertraversal of its nodes' values.For example: Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,3,2].Jav...
分类:
其他好文 时间:
2015-07-27 00:13:08
阅读次数:
144
Given a binary tree, return thepreordertraversal of its nodes' values.For example:Given binary tree{1,#,2,3}, 1 \ 2 / 3return[1,2,3]./**...
分类:
其他好文 时间:
2015-07-27 00:10:24
阅读次数:
195
辗转相除法(欧几里得算法)时间复杂度:在O(logmax(a, b))以内int gcd(int a, int b){ if (b == 0) return a; return gcd(b, a % b);} 扩展欧几里得算法时间复杂度和欧几里得算法相同int extgcd(int a, int ....
分类:
其他好文 时间:
2015-07-26 23:59:26
阅读次数:
402
Given a linked list, return the node where the cycle begins. If there is no cycle, returnnull.Follow up:Can you solve it without using extra space?因为f...
分类:
其他好文 时间:
2015-07-26 23:57:57
阅读次数:
213
Given n, generate all structurally unique BST's (binary search trees) that store values 1...n.For example,Given n = 3, your program should return all 5 unique BST's shown below. 1 3 3 ...
分类:
其他好文 时间:
2015-07-26 22:40:52
阅读次数:
158
Given a stringsand a dictionary of wordsdict, add spaces insto construct a sentence where each word is a valid dictionary word.Return all such possibl...
分类:
其他好文 时间:
2015-07-26 22:12:22
阅读次数:
100