#include
void print_subset(int n,int s)
{
for(int i=0;i<n;i++)
if(s&(1<<i)) printf("%d ",i);
printf("\n");
}
int main()
{
int n=3;
for(int i=0;i<(1<<n);i++)
print_subs...
分类:
其他好文 时间:
2015-07-30 11:15:40
阅读次数:
111
Thelongest common subsequence(LCS)problemis the problem of finding the longestsubsequencecommon to all sequences in a set of sequences (often just two...
分类:
其他好文 时间:
2015-07-30 07:10:57
阅读次数:
120
Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.
For example:
Given the following binary tree,
1...
分类:
其他好文 时间:
2015-07-29 21:18:23
阅读次数:
93
题意:给定一串括号,求最长的规则('(())'或‘(()())’)的字串及最长字串的个数;思路:使用栈保存左括号,与最近的右括号匹配,使用递推推出每个位置最长字串长度;#include#include#include#include#includeusing namespace std;stack ...
分类:
其他好文 时间:
2015-07-29 21:05:20
阅读次数:
91
题目:
Given an unsorted array of integers, find the length of the longest consecutive elements sequence.
For example,
Given [100, 4, 200, 1, 3, 2],
The longest consecutive elements sequence is...
分类:
编程语言 时间:
2015-07-29 19:30:05
阅读次数:
91
LeetCode 5_Longest Palindromic Substring
题目描述:
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 ...
分类:
其他好文 时间:
2015-07-29 15:57:00
阅读次数:
131
Surprising StringsTime Limit:1000MSMemory Limit:65536KTotal Submissions:5783Accepted:3792DescriptionTheD-pairsof a string of letters are the ordered p...
分类:
其他好文 时间:
2015-07-29 15:52:50
阅读次数:
127
Problem Definition: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...
分类:
其他好文 时间:
2015-07-28 17:22:12
阅读次数:
111
LeetCode 3_Longest Substring Without Repeating Characters
题目描述:
Given a string, find the length of the longest substring
without repeating characters. For example, the longest substring without re...
分类:
其他好文 时间:
2015-07-27 23:10:47
阅读次数:
106
Problem Definition:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring withoutre...
分类:
其他好文 时间:
2015-07-27 20:57:10
阅读次数:
105