Time Limit:2000MS Memory Limit:65536KBDescriptionGiven a string consisting of brackets of two types find its longest substring that is a regular brack...
Write a function to find the longest common prefix string amongst an array of strings.思路分析:这题很简单,基本就是以第一个字符串为标准,同时扫描后面的字符串对应index 字符是否相同,找到最大的相同前缀。但是实现的时候还是要注意一些corner case,比如输入数组为空或者只包含一个字符串的情况。AC Co...
分类:
其他好文 时间:
2015-02-23 12:02:19
阅读次数:
145
用Dp的思想解决了这道题目,也就是所谓的暴力= =题意:给出一个集合,一个字符串,找出这个字符串的最长前缀,使得前缀可以划分为这个集合中的元素(集合中的元素可以不全部使用)。还不会Trie 树QAQSource Code:/*ID: wushuai2PROG: prefixLANG: C++*///...
分类:
其他好文 时间:
2015-02-21 14:14:36
阅读次数:
116
LIS(Longest Increasing Subsequence)最长上升子序列 或者 最长不下降子序列。很基础的题目,有两种算法,复杂度分别为O(n*logn)和O(n^2) 。**********************************************************...
分类:
其他好文 时间:
2015-02-20 22:00:21
阅读次数:
245
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...
分类:
其他好文 时间:
2015-02-17 19:54:58
阅读次数:
146
欢迎大家阅读参考,如有错误或疑问请留言纠正,谢谢
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...
分类:
其他好文 时间:
2015-02-17 10:25:14
阅读次数:
168
本文是在学习中的总结,欢迎转载但请注明出处:http://blog.csdn.net/pistolove/article/details/43854597
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 elemen...
分类:
其他好文 时间:
2015-02-16 22:13:14
阅读次数:
234
http://acm.hdu.edu.cn/showproblem.php?pid=3534
Problem Description
In the Data structure class of HEU, the teacher asks one problem: How to find the longest path of one tree and the number...
分类:
其他好文 时间:
2015-02-14 18:56:57
阅读次数:
190
Longest Substring Without Repeating Characters 解题过程。
分类:
其他好文 时间:
2015-02-14 12:14:20
阅读次数:
117
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-02-13 21:15:47
阅读次数:
156