D - Two paths
只想到了一个o(n^2)的解法。
首先枚举删除一条边,必然得到两棵独立的树。计算两棵树的直径。保留最大乘积。
首先两条路不相交,则必然可以分到两棵子树中,因为要乘积最大,所以两条路必为两棵子树的直径。
#include
#include
#include
#include
#include
#include
#include
#include
#...
分类:
其他好文 时间:
2014-10-29 17:12:24
阅读次数:
225
Implement the following types and define ServeHTTP methods on them. Register them to handle specific paths in your web server.type String stringtype S...
分类:
Web程序 时间:
2014-10-28 23:51:10
阅读次数:
222
将Json存进本地文件夹NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);NSString *path=[paths objectAtIndex:0];NSSt...
分类:
移动开发 时间:
2014-10-28 23:34:22
阅读次数:
189
解决警告“warning:directorynotfoundforoption”1.选择工程, 编译的 (targets)2.选择 Build Settings菜单3.查找 Library Search Paths 和 Framework Search Paths, 删掉编译报warning的路径即...
分类:
其他好文 时间:
2014-10-28 20:01:52
阅读次数:
108
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Pathshow to load BPLs without writing them in the system directory or in the applicat...
分类:
移动开发 时间:
2014-10-28 20:01:45
阅读次数:
344
问题描述:
Given a binary tree and a sum, find all root-to-leaf paths where each path's sum equals the given sum.
For example:
Given the below binary tree and sum = 22,
5
/...
分类:
其他好文 时间:
2014-10-26 14:24:00
阅读次数:
224
require.js遵循AMD规范,通过define定义模块,require异步加载模块,一个js文件即一个模块。一、模块加载require1.加载符合AMD规范模块HTML:MAIN.JS require.config({ baseUrl: "js/lib", paths: { ...
分类:
Web程序 时间:
2014-10-25 22:53:49
阅读次数:
284
属于中规中矩的dp。和unique paths类似。一次ac。但是可以通过滚动数组来节省存储空间。 1 #include 2 #include 3 #include 4 using namespace std; 5 6 class Solution { 7 public: 8 int...
分类:
其他好文 时间:
2014-10-25 21:19:04
阅读次数:
244
Follow up for "Unique Paths":Now consider if some obstacles are added to the grids. How many unique paths would there be?An obstacle and empty space i...
分类:
其他好文 时间:
2014-10-24 18:07:56
阅读次数:
170
1 NSArray *paths=NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES); NSString *path=[paths objectAtIndex:0]; NSSt...
分类:
移动开发 时间:
2014-10-24 12:17:50
阅读次数:
141