newwork setup
#-*-coding:utf-8-*-
#########################################################################
# Copyright (C) 2017 All rights reserved.
#
# FileName:GetLongestSubString.py
# Creator: x'x'x@xxx.com
# Time:06/02/2017
# Description:
#
# Updates:
#
#########################################################################
#!/usr/bin/python
# please add your code here!
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的更多相关文章
- 使用Setup Factory安装包制作工具制作安装包
在我们开发完软件后,除了极个别案例我们把整个目录复制给客户用外,我们一般都需要做成安装包,方便整个软件的部署操作,以安装包的部署操作可能简单的是复制文件,也可能包括一些注册表.数据库等额外的操作,不过 ...
- Hive-0.x.x - Enviornment Setup
All Hadoop sub-projects such as Hive, Pig, and HBase support Linux operating system. Therefore, you ...
- C/S打包 客户端/windows程序 Inno Setup
之前介绍过InstallShield打包工具,本文再介绍更加方便的打包工具Inno Setup Inno Setup相对来说,比InstallShield更容易使用,不需要去等VS去创建项目,只要提供 ...
- A couple of notes about .NET Framework 4.6 setup behaviors
https://blogs.msdn.microsoft.com/astebner/2015/06/17/a-couple-of-notes-about-net-framework-4-6-setup ...
- Appium for iOS setup
windows下appium设置 之前研究了一段时间的appium for native app 相应的总结如下: ...
- RIDE -- Robot Framework setup
RobotFramework 是一款基于python 的可以实现关键字驱动和数据驱动并能够生成比较漂亮的测试报告的一款测试框架 这里使用的环境是 python-2.7.10.amd64.msi RID ...
- [Tool]Inno Setup创建软件安装程序。
这篇博客将介绍如何使用Inno Setup创建一个软件安装程序. Inno Setup官网:http://www.jrsoftware.org/isinfo.php. 可以下载到最新的Inno Set ...
- python setup.py 管理
发布项目遇到了坑……特此记录. How to write setup.py: https://docs.python.org/2/distutils/setupscript.html Setup.py ...
- inno setup读取注册表遇到的一个坑
一.背景 目前,公司针对PR开发的一个插件需要发布到64位系统上.该插件包括一个prm格式的文件和若干个DLL文件.其中,prm文件需要复制到PR公共插件目录下,DLL需要复制到Windows系统目录 ...
随机推荐
- 利用insertd查出更新记录
DROP TABLE #tableCREATE TABLE #table(CompanyID VARCHAR(20),BillNo VARCHAR(40))UPDATE dbo.SD_Inv_Move ...
- css隐藏多余的文字并出现省略号
<meta charset="utf-8" /> <style> .txt{ width:200px; border:1px solid #ddd; ove ...
- U盘安装centos7 关键步骤
出现安装界面 按tab键或e键进行修改 一般默认第二行为: vmlinuz intrd=initrd.img inst.stage2=hd:LABEL=CentOS\x207\x20x86_64 rd ...
- Codeforces Round #485 (Div. 2) E. Petr and Permutations
Codeforces Round #485 (Div. 2) E. Petr and Permutations 题目连接: http://codeforces.com/contest/987/prob ...
- BP神经网络 详解模板
%原始数据输入 P=[ - 6.142 - 27.5 5.068 - 31.7 5.196 - 34.1 6.362 - 31.54 6.472 - 30.17 6.578 - 29.53 6.351 ...
- 第4周小组作业:WordCount优化
Github项目地址:https://github.com/chaseMengdi/wcPro stage1:代码编写+单元测试 PSP表格 PSP2.1 PSP阶段 预估耗时(分钟) 实际耗时(分 ...
- NUC970开发板烧录
本次烧录的采用新塘公司官方的NuWriter软件进行烧录,现在我们首先来讲解如何将uboot,Linux内核,根文件系统烧录到开发板上. 过程中所需文件链接: 链接:https://pan.baidu ...
- grep 笔记
-a :将 binary 文件以 text 文件的方式搜寻数据-c :计算找到 '搜寻字符串' 的次数-i :忽略大小写的不同,所以大小写视为相同-n :顺便输出行号-v :反向选择,亦即显示出没有 ...
- Mapreduce操作HBase
这个操作和普通的Mapreduce还不太一样,比如普通的Mapreduce输入可以是txt文件等,Mapreduce可以直接读取Hive中的表的数据(能够看见是以类似txt文件形式),但Mapredu ...
- 背水一战 Windows 10 (116) - 后台任务: 前台程序激活后台任务
[源码下载] 背水一战 Windows 10 (116) - 后台任务: 前台程序激活后台任务 作者:webabcd 介绍背水一战 Windows 10 之 后台任务 前台程序激活后台任务 示例演示后 ...