码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
求二叉树节点的最大距离
距离即为节点间的边数。code:struct Node { Node* left; Node* right; int nmaxleft; int nmaxright; int vhvalue; };int ans;//答案int findmaxval(Node* root) { if (root == NULL) return; if (roo...
分类:其他好文   时间:2015-08-01 06:28:29    阅读次数:105
防止点击页面中文字被选中
//在body中加入 onselectstart="return false;"
分类:其他好文   时间:2015-08-01 00:51:30    阅读次数:407
js判断对象是不是Array对象的几种常用方法,验证是否是数字
var arr = [1,2,3]; //方法一: function isArray1(arr){ return Object.prototype.toString.call(arr) === ‘[object Array]‘; } //方法二: function isArray2(arr){ return arr.constructor.name ===...
分类:Web程序   时间:2015-07-31 23:43:59    阅读次数:304
编程实现单链表的排序
node *sort(node *head) { node *p, *p2, *p3; int n; int temp; n = length(head); if (head == NULL || head->next == NULL) return head; p = head; for (int j = 1; j { p = head; for (int i = 0;...
分类:编程语言   时间:2015-07-31 23:41:47    阅读次数:323
[LeetCode][Java] Palindrome Partitioning
题目: Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. For example, given s = "aab", Return [ ...
分类:编程语言   时间:2015-07-31 23:35:54    阅读次数:196
产生两个随机数,并且两个随机数之和为固定值
产生两个随机数,并且两个随机数之和为固定值function num(lbound, ubound) { return (Math.floor(Math.random() * (ubound - lbound)) + lbound);} var x=num(0,24); var z = 2...
分类:其他好文   时间:2015-07-31 23:18:37    阅读次数:102
(第三天)函数
定义函数关键字function用来定义函数。定义函数有两种方法(1)函数定义表达式1 var f = function(x) { return x+1; }(2)函数声明语句1 function funcname([arg1 [, arg2 [...,argn]]]) {2 3 }函数声明语句通常出...
分类:其他好文   时间:2015-07-31 23:09:18    阅读次数:182
04_单例模式
单例模式   /**  * 1.最简单的单体模式就是一个对象字面量,用于将一组属性和方法组织在一起。  */ var Application = {     version: 1.0,     getAppInfo: function () {         return "app";     } }; /**  * 2. 为了能在单例对象中创建真正的私有变量,可...
分类:其他好文   时间:2015-07-31 22:02:36    阅读次数:134
(easy)LeetCode 217.Contains Duplicate
Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at least twice in the arr...
分类:其他好文   时间:2015-07-31 21:49:22    阅读次数:225
C++对象模型——程序转化语意学(第二章)
2.3    程序转化语意学 (Program Transformation Semantics)     如下程序片段所示: #include ‘"X.h" X foo() { X xx; return xx; }    看到这个代码,可能做出以下假设:     1.    每次foo()被调用,就传回xx的值     2.    如果 class X定义了一个copy...
分类:编程语言   时间:2015-07-31 18:37:48    阅读次数:163
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!