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-11-29 21:37:03
阅读次数:
330
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...
分类:
其他好文 时间:
2014-11-29 18:54:45
阅读次数:
180
要求:此题正好和Maximum Depth of Binary Tree一题是相反的,即寻找二叉树的最小的深度值:从根节点到最近的叶子节点的距离。结题思路:和找最大距离不同之处在于:找最小距离要注意(lleft);13 int r = minDepth(root->right);14 ...
分类:
其他好文 时间:
2014-11-29 18:47:40
阅读次数:
182
Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorithm to find the maximum profit. You may complete a...
分类:
其他好文 时间:
2014-11-29 13:05:29
阅读次数:
161
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 produc...
分类:
其他好文 时间:
2014-11-29 07:08:33
阅读次数:
174
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 le...
分类:
其他好文 时间:
2014-11-29 06:50:19
阅读次数:
189
返回树的深度。递归:/** * Definition for binary tree * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode(int x) : val...
分类:
其他好文 时间:
2014-11-28 16:06:24
阅读次数:
103
The circuit inFigure 1uses a minimal number of external parts to raise the maximum output current of a 0.5A buck switching-regulator IC to more than 6...
分类:
其他好文 时间:
2014-11-28 15:46:59
阅读次数:
253
Voltage-regulator design for high output currents can be a critical and difficult task. Although voltage regulators with 1A maximum output current are...
分类:
其他好文 时间:
2014-11-28 14:02:24
阅读次数:
133
Given a binary tree, find the maximum path sum.The path may start and end at any node in the tree.找树的最大路径和 注意路径可以从任意点起始和结束。我发现我真的还挺擅长树的题目的,递归不难。就是因为有个...
分类:
其他好文 时间:
2014-11-27 23:24:02
阅读次数:
284