码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
POJ-1005
#include #include //#include using namespace std; #define PI 3.1415926 /* return: years */ int recursionFunc(float rCurrent, float xYMin){ float r; if(rCurrent==0){ r=sqrt(100.0/PI); }else{ ...
分类:其他好文   时间:2015-07-11 06:44:28    阅读次数:89
LeetCode Power of Two (2的幂)
题意:判断1个数n是否刚好是2的幂,幂大于0。思路:注意会给负数,奇数。对于每个数判断31次即可。 1 class Solution { 2 public: 3 bool isPowerOfTwo(int n) { 4 if(n1) return false; 5 ...
分类:其他好文   时间:2015-07-11 01:03:46    阅读次数:116
leetcode104 Maximum Depth
题意:二叉树最大深度思路:递归,但是不知道怎么回事直接在return里面计算总是报超时,用俩变量就可以A···奇怪,没想通代码:int maxDepth(TreeNode* root) { if(!root) return 0; int l = ma...
分类:其他好文   时间:2015-07-11 01:00:42    阅读次数:110
javascript 函数的定义与参数的有无
一、函数定义function fName(params){ statements; return somevalue;//可以省略}注意事项:1、参数可有,可无。不定义参数,在调用参数时,也可以传入参数;例如: 1 function add(){ 2 if(arguments.lengt...
分类:编程语言   时间:2015-07-11 00:56:27    阅读次数:192
POJ-1003
#include using namespace std; int recursionFunc(int cardNum, float len){ if(1.0/(cardNum+1)>=len){ return cardNum; }else{ return recursionFunc(cardNum+1, len-(1.0/(cardNum+1))); } } int main(...
分类:其他好文   时间:2015-07-10 23:45:24    阅读次数:129
LeetCode225:Implement Stack using Queues
Implement the following operations of a stack using queues.push(x) – Push element x onto stack. pop() – Removes the element on top of the stack. top() – Get the top element. empty() – Return whether...
分类:其他好文   时间:2015-07-10 23:45:02    阅读次数:146
JS-商品图片点击轮换
//小图预览区域图片轮换键const LIWIDTH=62;var moveCount=0;document.getElementById("btForward").onclick=function(){ if(this.className=="forward_disabled"){ return....
分类:Web程序   时间:2015-07-10 23:36:35    阅读次数:192
Java for LeetCode 228 Summary Ranges
Given a sorted integer array without duplicates, return the summary of its ranges.For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"].解题思路:JA...
分类:编程语言   时间:2015-07-10 23:33:20    阅读次数:232
[LeetCode][Java] Reverse Nodes in k-Group
题目: Given a linked list, reverse the nodes of a linked list k at a time and return its modified list. If the number of nodes is not a multiple of k then left-out nodes in the end should remain...
分类:编程语言   时间:2015-07-10 22:26:04    阅读次数:154
38.数字在排序数组中出现的次数
半段查找。 int GetFirstK(int* data, int length, int k, int start, int end) { if (start > end) return -1; int middleIndex = (start + end) / 2; int middleData = data[middleIndex]; if (middleData == k)...
分类:编程语言   时间:2015-07-10 22:24:50    阅读次数:178
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!