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
1、onclick="save();return false;" 取消“浏览器默认行为”。 比如一个链接 百度知道 当我们点击这个链接时,浏览器会自动跳转到:zhidao.baidu.com这个地址,这是浏览器的默认行为,如果我们这么做: 百度知道 那么再次点击这个链接时,浏览器则不会进...
分类:
编程语言 时间:
2014-07-16 23:17:04
阅读次数:
360
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
解决办法:\Data\Ueditor\php\Uploader.class.php190行左右/** * 获取文件扩展名 * @return string */ private function getFileExt() { date_default...
分类:
其他好文 时间:
2014-07-16 23:12:13
阅读次数:
206
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
题目:
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
本题解法很多,因为给出的数据特殊性故此可以使用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
#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
题目
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