码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
欧几里得算法求两个整数的最大公因数
unsigned int Gcd (unsigned int m,unsigned int n){ unsigned int rem; while(n>0){ rem = m % n; m = n; n = rem; } return...
分类:其他好文   时间:2014-07-16 23:18:24    阅读次数:497
javascript一些有用但又不常用的特性
1、onclick="save();return false;" 取消“浏览器默认行为”。 比如一个链接 百度知道 当我们点击这个链接时,浏览器会自动跳转到:zhidao.baidu.com这个地址,这是浏览器的默认行为,如果我们这么做: 百度知道 那么再次点击这个链接时,浏览器则不会进...
分类:编程语言   时间:2014-07-16 23:17:04    阅读次数:360
Search Insert Position (LeetCode)
Given a sorted array and a target value, return the index if the target is found. If not, return the index where it would be if it were inserted in or...
分类:其他好文   时间:2014-07-16 23:16:32    阅读次数:156
百度Ueditor 图片上传无反应,显示上传0张,不能点确定
解决办法:\Data\Ueditor\php\Uploader.class.php190行左右/** * 获取文件扩展名 * @return string */ private function getFileExt() { date_default...
分类:其他好文   时间:2014-07-16 23:12:13    阅读次数:206
Leetcode: Permutations
Given a collection of numbers, return all possible permutations.For example,[1,2,3] have the following permutations:[1,2,3], [1,3,2], [2,1,3], [2,3,1]...
分类:其他好文   时间:2014-07-10 13:34:30    阅读次数:208
Leetcode-Two Sum
题目: Given an array of integers, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbers such that they add up to the ta...
分类:其他好文   时间:2014-06-28 08:17:11    阅读次数:305
POJ 3628 Bookshelf 2 题解
本题解法很多,因为给出的数据特殊性故此可以使用DFS和BFS,也可以使用01背包DP思想来解。 这里使用BFS,缺点是比DFS更加耗内存,不过优点是速度比DFS快。 当然也比DFS难写点: int N, B; int Height[21]; inline int mMin(int a, int b) { return a > b? b : a; } inline int mMax(int a...
分类:其他好文   时间:2014-06-28 08:11:26    阅读次数:238
正整数划分的另一种解法 (纯递归)
Step 1: n ==1 : return 1 n == 2 : return  [1,1],[2]Step 2:for n > 2a.arr.push(n)b.arr.push([n-1,1])c.1 get result of recursion(n-2)c.2 combine n==2 & result => retc.3 remove duplicate record in retcod...
分类:其他好文   时间:2014-06-28 07:17:11    阅读次数:255
给定单向链表的头指针和一个结点指针,定义一个函数在O(1)时间删除该结点
#include #include #include #include using namespace std; struct Node { int data; struct Node* next; }; struct Node* create_list(int len) { if (len <= 0) return NULL; struct Node* head; ...
分类:其他好文   时间:2014-06-27 23:54:36    阅读次数:311
Permutations
题目 Given a collection of numbers, return all possible permutations. For example, [1,2,3] have the following permutations: [1,2,3], [1,3,2], [2,1,3], [2,3,1], [3,1,2], and [3,2,1]....
分类:其他好文   时间:2014-06-27 23:48:51    阅读次数:240
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!