分析:最大团的模版题,DFS深搜。
#include
using namespace std;
#define N 55
int map[N][N];
int set[N];
int max;
bool IsConnect(int end,int v)
{
int i;
for(i=0;i<end;i++)
if(!map[set[i]][v])
return false;
...
分类:
其他好文 时间:
2015-05-01 13:27:54
阅读次数:
157
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.
题意:求树的高度。
思路:就是递归。
/**
* Definiti...
分类:
其他好文 时间:
2015-05-01 12:06:48
阅读次数:
163
Given a stringS, find the longest palindromic substring inS. You may assume that the maximum length ofSis 1000, and there exists one unique longest pa...
分类:
其他好文 时间:
2015-04-30 06:19:30
阅读次数:
117
Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longes...
分类:
其他好文 时间:
2015-04-29 01:54:46
阅读次数:
113
【题目】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,...
分类:
其他好文 时间:
2015-04-28 11:34:29
阅读次数:
102
problem:
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
/ 2 3
...
分类:
其他好文 时间:
2015-04-27 13:20:29
阅读次数:
130
problem:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete as many transactions as ...
分类:
其他好文 时间:
2015-04-27 11:22:20
阅读次数:
123
problem:
Say you have an array for which the ith element is the price of a given stock on day i.
Design an algorithm to find the maximum profit. You may complete at most two transactions...
分类:
其他好文 时间:
2015-04-27 11:18:37
阅读次数:
134
https://leetcode.com/problems/binary-tree-maximum-path-sum/Given a binary tree, find the maximum path sum.The path may start and end at any node in th...
分类:
其他好文 时间:
2015-04-26 22:23:56
阅读次数:
174
MSL就是maximum segment lifetime(最大分节生命期),这是一个IP数据包能在互联网上生存的最长时间,超过这个时间将在网络中消失TIME_WAIT两点原因:1、TCP分节可能由于路由器异常而“迷途”,在迷途期间,TCP发送端可能因确认超时而重发这个分节,迷途的分节在路由器修复后...
分类:
其他好文 时间:
2015-04-26 21:13:50
阅读次数:
146