题目地址: https://leetcode.com/problems/longest-palindromic-substring/description/ 题目: 其实就是求一个字符串的最长回文子字符串。 解法: 我首先采取了暴力解法,不出意料地TLE了。这是超时的TLE解法: 这类题目一看就是用 ...
分类:
其他好文 时间:
2017-12-03 18:08:43
阅读次数:
134
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 题目描述:给定字符串,求出最大的 ...
分类:
其他好文 时间:
2017-12-03 17:12:36
阅读次数:
111
Write a function to find the longest common prefix string amongst an array of strings. 题目的描述很简单,就是求多个字符串公共前缀,其实可以考虑先对字符向量用sort()进行排序,然后从前向后遍历,复杂度为O(S) ...
分类:
其他好文 时间:
2017-12-03 15:35:06
阅读次数:
161
Write a function to find the longest common prefix string amongst an array of strings.第二遍做法:时间复杂度应该是O(m*n),m表示字符串的最大长度,n表示字符串的个数,空间复杂度应该是O(m),即字符串的长度 ... ...
分类:
其他好文 时间:
2017-12-03 13:00:03
阅读次数:
186
关系 List 是 Java Interface, ArrayList 是 Java Class,它们都属于 java.util 包。 Java List 是有序的集合(ordered collection),也称为序列(Sequence); Java ArrayList 是 Java List I ...
分类:
编程语言 时间:
2017-12-02 17:39:06
阅读次数:
215
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example: 1. O(n2 * l)复杂度做 ...
分类:
其他好文 时间:
2017-12-02 11:15:19
阅读次数:
120
Given a list of strings words representing an English Dictionary, find the longest word in words that can be built one character at a time by other wo ...
分类:
其他好文 时间:
2017-11-30 11:56:38
阅读次数:
123
Given a string which consists of lowercase or uppercase letters, find the length of the longest palindromes that can be built with those letters. This ...
分类:
其他好文 时间:
2017-11-29 21:59:49
阅读次数:
120
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: 寻找最长回文字符串。 用动态规划。dp[i][j] ...
分类:
其他好文 时间:
2017-11-29 16:09:05
阅读次数:
140
本文实例讲述了C#实现左截取和右截取字符串的方法,分享给大家供大家参考。具体方法分析如下: 问题如下: 使用C#语法编写程序时,我们需要截取一个字符串左边或右边的若干个字符,该如何操作呢? 在VB中可以使用left或right函数实现,C#中没有提供这样的函数呢?答案是没有。但是,C#中提供Subs ...