Pizza piecesDescriptionIn her trip to Italy, Elizabeth Gilbert made it her duty to eat perfect pizza. One day, she ordered one for dinner. And then so...
分类:
其他好文 时间:
2015-07-06 19:47:09
阅读次数:
101
题目:
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-07-06 16:06:14
阅读次数:
143
题意是寻找一个字符串的最大回文字串,最简单的是n3方的算法,由于字符串最大长度为1000,所以这个方法很危险而且不科学。紧接着想到的是一个n方的算法:回文子串是从中间向两边产生的,那么对于每个字符考察这个字符往外的所有可能不就可以找到以这个字符为中心的最长回文子串了吗?当然要考虑偶数的情况,即那个中...
分类:
其他好文 时间:
2015-07-06 15:51:01
阅读次数:
106
wyq说刚入门oi 或是遇到瓶颈的时候就刷DP吧,虽然觉得这么刷CF题有点浪费,但是还是挺爽的,按照solved排序做的,前面的题都挺水的(忘记记录了混蛋),就不写了,从5C开始写解题CF5 C. Longest Regular Bracket Sequence:题目大意,给一个括号序列,让你求最长...
分类:
其他好文 时间:
2015-07-06 15:36:02
阅读次数:
94
题目:
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 longest palindromic substring.
题意:
给定字符串S...
分类:
编程语言 时间:
2015-07-06 12:30:14
阅读次数:
115
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.Hide Tags: Tree ,Depth-first Search/**
* D...
分类:
其他好文 时间:
2015-07-06 12:29:01
阅读次数:
112
Find the capitalsDescription:InstructionsWrite a function that takes a single string (word) as argument. The function must return an ordered list cont...
Q:Given a string, find the length of the longest substring without repeating characters. For example, the longest substring without repeating letters ...
分类:
其他好文 时间:
2015-07-05 16:41:08
阅读次数:
97
public class Solution { public String longestPalindrome(String s) { //本题是动态规划思想,构造一个数组pal[i][j],表示从i到j是否为一个回文, //pal[i][j]=true;if i=...
分类:
其他好文 时间:
2015-07-04 22:14:37
阅读次数:
236
题目: 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 lo...
分类:
其他好文 时间:
2015-07-04 18:11:21
阅读次数:
119