码迷,mamicode.com
首页 >  
搜索关键字:two sum    ( 31846个结果
Divide Two Integers
Divide two integers without using multiplication, division and mod operator.思路:不能使用乘法除法以及取模运算来计算两个数相除。主要做法就是,将因子不断乘2(向左移位即可实现),同时结果从1不断移位加倍,等到除数大于被除数一...
分类:其他好文   时间:2014-07-06 15:34:24    阅读次数:197
[Leetcode][Tree][Binary Tree Maximum Path Sum]
找书中权值和最大的路径,至少包含一个点。有点类似LCA(最近公共祖先),树的问题关键是如何划分子问题,然后递归求解。想到了可以返回两种结果,一个是单独路径的最大和,一种是子树的最大和,然后在求解的过程中不断的更新答案。 1 /** 2 * Definition for binary tree 3 ....
分类:其他好文   时间:2014-07-06 14:16:47    阅读次数:187
leetcode--Scramble String
Given a strings1, we may represent it as a binary tree by partitioning it to two non-empty substrings recursively.Below is one possible representation...
分类:其他好文   时间:2014-07-06 13:57:54    阅读次数:155
leetcode--N-Queens
Then-queens puzzle is the problem of placingnqueens on ann×nchessboard such that no two queens attack each other.Given an integern, return all distinc...
分类:其他好文   时间:2014-07-06 13:32:49    阅读次数:204
Oracle组函数、多表查询、集合运算、数据库对象(序列、视图、约束、索引、同义词)等
count组函数:(过滤掉空的字段)select count(address),count(*) from b_usermax() avg() min(),sum()select sum(age),max(age),min(age),avg(nvl(age,0)) from b_user1 260 ...
分类:数据库   时间:2014-07-06 12:58:24    阅读次数:364
[Leetcode][Tree][Path Sum]
很简单的一道题,判断和为sum的路径是否存在。结果WA了两次,一次是由于没有考虑清楚深搜停止的条件,另外一次是由于没有考虑到Path必须是从root到leaf的。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * ...
分类:其他好文   时间:2014-07-05 22:39:11    阅读次数:253
LeetCode:Combinations
Given two integers n and k, return all possible combinations of k numbers out of 1 ...n.For example,If n = 4 and k = 2, a solution is:[ [2,4], [3,4...
分类:其他好文   时间:2014-07-05 22:10:53    阅读次数:226
[Leetcode][Tree][Sum Root to Leaf Numbers]
非常简单的一个题,和path sum非常类似。 1 /** 2 * Definition for binary tree 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *rig...
分类:其他好文   时间:2014-07-05 22:03:48    阅读次数:251
CTCI 1.3
Description: Given two strings, write a method to decide if one is a permutation of the other.We could use the same idea from CTCI 1.1. The only diffe...
分类:其他好文   时间:2014-07-05 21:43:01    阅读次数:231
Binary Tree Maximum Path Sum
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.For example:Given the below binary tree, 1 ...
分类:其他好文   时间:2014-07-05 20:43:45    阅读次数:246
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!