码迷,mamicode.com
首页 >  
搜索关键字:return    ( 60766个结果
图的深度优先遍历DFS
图的深度优先遍历是树的前序遍历的应用,其实就是一个递归的过程,我们人为的规定一种条件,或者说一种继续遍历下去的判断条件,只要满足我们定义的这种条件,我们就遍历下去,当然,走过的节点必须记录下来,当条件不满足后,我们就return,回到上一层,换个方向继续遍历。模板: 1 //邻接矩阵存储方式 2 b...
分类:其他好文   时间:2014-06-08 23:50:57    阅读次数:420
[LeetCode OJ] Max Points on a Line—Given n points on a 2D plane, find the maximum number of points that lie on the same straight line.
//定义二维平面上的点struct Point{ int x; int y; Point(int a=0, int b=0):x(a),y(b){}};bool operator==(const Point& left, const Point& right){ return...
分类:其他好文   时间:2014-06-08 22:26:17    阅读次数:357
[leetcode]Sqrt(x) @ Python
原题地址:https://oj.leetcode.com/problems/sqrtx/题意:Implementint sqrt(int x).Compute and return the square root ofx.解题思路:实现开平方函数。这里要注意的一点是返回的时一个整数。通过这一点我们可...
分类:编程语言   时间:2014-06-08 21:04:38    阅读次数:329
简单排序poj2388
#include #include #include #include using namespace std;int cmp(const void *a,const void *b){ return *(int *)a-*(int *)b;}int main(){ int n; ...
分类:其他好文   时间:2014-06-08 20:51:16    阅读次数:202
[leetcode]Add Binary @ Python
原题地址:https://oj.leetcode.com/problems/add-binary/题意:Given two binary strings, return their sum (also a binary string).For example,a ="11"b ="1"Return"...
分类:编程语言   时间:2014-06-08 20:28:04    阅读次数:300
Subsets II
题目 Given a collection of integers that might contain duplicates, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not c...
分类:其他好文   时间:2014-06-08 05:32:21    阅读次数:196
Subsets
题目 Given a set of distinct integers, S, return all possible subsets. Note: Elements in a subset must be in non-descending order.The solution set must not contain duplicate subsets. ...
分类:其他好文   时间:2014-06-08 04:01:05    阅读次数:240
java完美equals方法代码段
public boolean equals(Object otherObject) { if(this == otherObject) { // 检测this与otherObject是否引用同一个对象 return true; } if(null == otherObject ) { // 检测otherObject是否为空 ret...
分类:编程语言   时间:2014-06-08 04:00:26    阅读次数:299
事件绑定和阻止默认事件
一般 为了阻止默认事件,我们都用return false,但是 如果你用了事件绑定,return false在高版本浏览其中就会失效,但是低版本浏览器中还是可以的,我们可以使用事件对象里面preventDefault()方法来去解决高版本浏览器中事件绑定了无法用return false阻止默认事件的问题。 例如:取消鼠标右击后出现的默认菜单 document.oncontextmenu=fun...
分类:其他好文   时间:2014-06-08 03:52:20    阅读次数:380
Leetcode: Wildcard Matching. java
Implement wildcard pattern matching with support for '?' and '*'.public class Solution { public boolean isMatch(String s, String p) { if (s == null || p == null) return false; if (...
分类:编程语言   时间:2014-06-08 03:10:46    阅读次数:216
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!