```#-*-coding:utf-8-*-
#########################################################################
#
# FileName:GetLongestSubString.py
# Creator: x'x'x@xxx.com
# Time:06/02/2017
# Description:
#
#
#########################################################################
#!/usr/bin/python
import re;
import sys;
import time;
def PrintUsage():
sys.stderr.write("program [IN]\n");
sys.exit(1);
class Solution:
def GetLongestSubString(self,s1,s2):
'''
compute longest substring of input string s1 and s2
'''
maxLen = 0;
endIndex = 0;
print("s1="+s1);
print("s2="+s2);
if ( len(s1) == 0 or len(s2) == 0 ):
return "";
table=[[] for i in range(len(s1))];
for i in range(len(table)):
table[i]=[0 for j in range(len(s2))];
for i in range(0,len(s1)):
for j in range(0,len(s2)):
if ( i == 0 or j == 0 ):
if ( s1[i]==s2[j] ):
table[i][j] = 1;
if ( table[i][j] > maxLen ):
maxLen = table[i][j];
endIndex = i;
else:
if ( s1[i]==s2[j] ):
table[i][j] = table[i-1][j-1]+1;
if (table[i][j] > maxLen):
maxLen = table[i][j];
endIndex = i;
print(table);
return s1[endIndex-maxLen+1:endIndex+1];
if (__name__=="__main__"):
if (len(sys.argv) != 1):
PrintUsage();
sys.exit(1);
starttime = time.clock();
s1="gcdef";
s2="abcdef";
sol = Solution();
print(sol.GetLongestSubString(s1,s2));
endtime = time.clock();
interval = endtime - starttime;
sys.stderr.write("%s has finished congratulations!\n"%str(sys.argv[0]));
sys.stderr.write("time elapse:%f\n"%interval);```

## newwork setup More articles about

1. Use Setup Factory Installation package making tool make installation package

After we develop the software , In addition to very few cases, we copy the entire directory to customers , We usually need to make installation package , Facilitate the deployment of the entire software operation , The deployment operation of the installation package may be as simple as copying files , It may also include some registry . Database and other additional operations , however ...

2. Hive-0.x.x - Enviornment Setup

All Hadoop sub-projects such as Hive, Pig, and HBase support Linux operating system. Therefore, you ...

3. C/S pack client /windows Program Inno Setup

Previously introduced InstallShield Packaging tools , This article introduces more convenient packaging tools Inno Setup Inno Setup relatively speaking , Than InstallShield Easier to use , There's no need to wait VS To create a project , Just provide ...

4. A couple of notes about .NET Framework 4.6 setup behaviors

5. Appium for iOS setup

windows Next appium Set up I've been studying it for a while appium for native app The corresponding summary is as follows :                                           ...

6. RIDE -- Robot Framework setup

RobotFramework It's based on python Can achieve Keyword Driven and data driven, and can generate a more beautiful test report of a test framework The environment used here is  python-2.7.10.amd64.msi RID ...

7. [Tool]Inno Setup Create a software installation program .

This blog will show you how to use Inno Setup Create a software installation program . Inno Setup Official website :http://www.jrsoftware.org/isinfo.php. It can be downloaded to the latest Inno Set ...

8. python setup.py management

The release project ran into a hole …… I wish to record . How to write setup.py: https://docs.python.org/2/distutils/setupscript.html Setup.py ...

9. inno setup A hole encountered in reading the registry

One . background at present , The company aims at PR A developed plug-in needs to be published to 64 Bit system . The plug-in includes a prm Format files and several DLL file . among ,prm Files need to be copied to PR Public plug-in Directory ,DLL It needs to be copied to Windows System catalog ...

## Random recommendation

1. Redis Do message queuing

Generally speaking , There are two scenarios for message queuing , One is the publisher subscriber model , One is the producer consumer model . utilize redis Message queuing in both scenarios can be implemented . Definition : Producer consumer model : Producers produce messages and put them in queues , Multiple consumers listen to the queue at the same time , ...

2. CSS Style sheets （ 3、 ... and ）

The front-end staff often use in the learning and development process CSS Style summary : [margin] margin Retrieve or set the extended margins of the four sides of an object margin-top Retrieve or set the extended margin of the top edge of an object margin-right Retrieve or set up the ...

3. 10 A boy and n Two girls bought n2+8n+2 This book , It is known that they each buy the same number of books , And there are more girls than in Nanhai , Ask the number of girls ？( Principle of integral Division 1.1.3)

10 A boy and n Two girls bought n2+8n+2 This book , It is known that they each buy the same number of books , And there are more girls than in Nanhai , Ask the number of girls ? Explain : because , Everyone buys the same number of books , therefore ,10|n2+8n+2 the ...

4. php All the configuration files and functions in the environment

The following is mainly aimed at linux Directory below (windows Is the same , The file names are all the same ) Apache:etc/httpd.conf PHP:etc/php.ini   (Apache  Running  PHP  edition ) M ...

5. cesium Map switching display effect （ Download the source code ）

Preface cesium Official website api The document describes the address cesium Official website api, There is a detailed introduction cesium Introduction of each class , There are also online examples :cesium Official website online example , This is also learning cesium Good material for . Inside ...

6. JS Of string operation

1. charAt(); If you want to get the character encoding , be :charCodeAt(); var stringValue ="hello world"; alert(stringValue.ch ...

7. Fiddler_ Bag capture application _01

1.  Mobile phone packet capture configuration 1.1. Fiddler To configure Tools->Options Grab https Request : see Fiddler port 1.2.  obtain Fiddler Where IP (1)  It can be done by fiddle ...