Givennpoints on a 2D plane, find the maximum number of points that lie on the same straight line.Hide TagsHash TableMath给出平面上的点,问一条直线最多穿过几个点.要不是之前看过这个...
分类:
其他好文 时间:
2015-06-25 19:18:34
阅读次数:
124
最大乘积子序列思想:动态规划+最大最小数组 状态方程:考虑到负数,所以加上一个min。 max[i] = Max(max[i-1]*nums[i],min[i-1]*nums[i],nums[i]); min[i] = Min(max[i-1]*nums[i],min[i-1]*n...
分类:
其他好文 时间:
2015-06-25 12:03:29
阅读次数:
95
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array[?2,1,?3,4,?1,2,1,...
分类:
其他好文 时间:
2015-06-25 10:17:54
阅读次数:
133
1. Question求二叉树的最大深度。Given a binary tree, find its maximum depth.The maximum depth is the number of nodes along the longest path from the root node do...
分类:
其他好文 时间:
2015-06-25 00:00:30
阅读次数:
281
#104 Maximum Depth of Binary Tree
Given a binary tree, find its maximum depth.
The maximum depth is the number of nodes along the longest path from the root node down to the farthest leaf node...
分类:
其他好文 时间:
2015-06-24 22:38:28
阅读次数:
164
非递归: public static int maxDepth(TreeNode root){ if(root==null) return 0; Queue q=new LinkedList(); q.offer(root); int enQu...
分类:
其他好文 时间:
2015-06-24 12:26:34
阅读次数:
98
Find the contiguous subarray within an array (containing at least one number) which has the largest product.For example, given the array [2,3,-2,4],
the contiguous subarray [2,3] has the largest produ...
分类:
其他好文 时间:
2015-06-23 23:15:40
阅读次数:
144
这里要用到桶排序,感觉不太感兴趣,就直接看了网上的做法。C++中vector中的一些常用函数:取容器中的最大最小值min_element(),max_element()。当有必要对一个接受pair参数的函数传递两个值时, make_pair()尤其显得方便。int minAll = *min_ele...
分类:
其他好文 时间:
2015-06-23 19:57:47
阅读次数:
124
Maximum Subarray: https://leetcode.com/problems/maximum-subarray/
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.For example, given the array [...
分类:
其他好文 时间:
2015-06-23 13:40:52
阅读次数:
145
Find the contiguous subarray within an array (containing at least one number) which has the largest sum.
For example, given the array [?2,1,?3,4,?1,2,1,?5,4],
the contiguous subarray [4,?1,2,1] ha...
分类:
其他好文 时间:
2015-06-23 11:55:55
阅读次数:
176