其实做起来会感觉很简单,需要注意的是要考虑效率的问题,毕竟可能是很长的字符串数组,所以可以考虑选取所有字符串中最短的那个来首先进行比较,因为最长公共子串肯定不会大于其长度,这样避免了字符串之间长度差异很大造成的效率损失,然后每次比较之后最长公共子串的长度也永远不会大于最短的那个字符串,只会不变或相等,只要遍历字符串数组,挨个对比、更改最短公共字符串记录即可,code如下:...
分类:
其他好文 时间:
2014-06-11 06:58:55
阅读次数:
226
题意:http://acdream.info/problem?pid=1112
Problem Description
Here is Alice and Bob again !
Alice and Bob are playing a game. There are several numbers.First, Alice choose a number n.Then he c...
分类:
其他好文 时间:
2014-06-10 14:48:56
阅读次数:
236
网络通信协议java通信协议本文比较了RMI,Hessian,Burlap,Httpinvoker,Web
service等5种通讯协议的在不同的数据结构和不同数据量时的传输性能。1.
简介RMI是java语言本身提供的远程通讯协议,稳定高效,是EJB的基础。但它只能用于JAVA程序之间的通讯。He...
分类:
编程语言 时间:
2014-06-10 12:54:29
阅读次数:
452
如何用php批量删除数据库下所有前缀为prefix_的表。例子,统一删除前缀为“prefix_”的表。"; } } }
?>操作实例:新建一个php文件,保存为deletedata.php。比如,要删除www.jbxue.com或者http://www.jbxue.com/的后台数据,操作两个步骤就...
分类:
数据库 时间:
2014-06-10 09:02:46
阅读次数:
240
戳我去解题Write a function to find the longest
common prefix string amongst an array of strings.class Solution {public: string
longestCommonPrefix(vecto...
分类:
其他好文 时间:
2014-06-10 08:29:55
阅读次数:
189
题目描述:
Write a function to find the longest common prefix string amongst an
array of strings.
很简单的一道题目,但是我写了两个不一样的版本,运行时间确实数倍之差。。贴代码如下:
版本1:
{CSDN:CODE:384511}
这个版本的运行时间为 44 ms...
分类:
其他好文 时间:
2014-06-10 08:18:58
阅读次数:
291
一次总结两道题,两道题目都比较基础Description:Write a function to
find the longest common prefix string amongst an array of strings.分析:
这道题目最重要的知道什么叫prefix前缀, 否则一不小心就做...
分类:
其他好文 时间:
2014-06-09 21:08:16
阅读次数:
224
题目描述Timy is visiting a beautiful park. There are M
rivers and N lakes(marked 1-N), any two lakes are connected by at most one
river. He knows that the...
分类:
其他好文 时间:
2014-06-09 20:57:26
阅读次数:
259
Problem Description
Ignatius is so lucky that he met a Martian yesterday. But he didn't know the language the Martians use. The Martian gives him a history book of Mars and a dictionary when it leave...
分类:
其他好文 时间:
2014-06-08 03:55:37
阅读次数:
273
软件下载(Nginx官网):http://nginx.org/一、准备环境:1、安装pcre:pcre(PerlCompatibleRegularExpressions:Perl兼容的正则表达式)用来支持rewritecd/tol/softtar-jxfpcre-8.32.tar.bz2cdpcre-8.32./configure--prefix=/usr/local/pcremake&&makeinstallcp/usr/..
分类:
其他好文 时间:
2014-06-08 02:33:34
阅读次数:
263