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系统目录 ...
随机推荐
- 使用idea搭建maven-web项目
使用idea搭建maven-web项目 1.用idea搭建项目:File--new--project 2.选择jdk版本,选择Maven-archetype-webapp来创建maven-web项目如 ...
- JavaScript基础视频教程总结(101-110章)
<!DOCTYPE html> <html> <head> <meta charset="utf-8" /> <title&g ...
- JSP 前端的一些应用
Ext标签库 一.Ext.VeiwPort 代表整个浏览器显示区域,该对象渲染到页面的body 区域,并会随着浏览器显示区域的大小自动改变,一个页面中只能有一个ViewPort 实例. <scr ...
- Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes
Codeforces Educational Codeforces Round 44 (Rated for Div. 2) E. Pencils and Boxes 题目连接: http://code ...
- python 线程Queue 用法代码展示
from queue import Queue q = Queue(maxsize=3)#限制队列3个 #添加内容进去到队列 q.put(10) q.put(20) q.put(30) print(q ...
- python3+redis问题求解
学生管理系统 更新学生信息没做出来,找个大神补全下.谢谢. # 记录: # bug:操作后若退出需要两次退出才行. 待修复 # 下一步:链接redis进行使用. # 更新学生库信息 待完成 imp ...
- MFC对话框和属性表
对话框主要有两类,分为模式和无模式,它们的功能都被封装在了CDialog中.与对话框相近的是属性表,属性表实际上是具有制表页(TAB 页)的对话框,将对话框中控件更好的组织在一起.借助Cpropert ...
- Python小练习之寻找101到200之间的素数
方法1:from math import * def primeNumber(start,end): num = 0 for i in range(start,end): flag = 0 for j ...
- 背水一战 Windows 10 (105) - 通知(Toast): 带按钮的 toast, 带输入的 toast(文本输入框,下拉选择框)
[源码下载] 背水一战 Windows 10 (105) - 通知(Toast): 带按钮的 toast, 带输入的 toast(文本输入框,下拉选择框) 作者:webabcd 介绍背水一战 Wind ...
- JDK设计模式之—单例模式和static关键字
首先了解static 关键字 static声明的方法是静态方法,static声明的成员变量为静态成员变量.对于该类的所有对象来说,static的成员变量和static只有一份存储空间 即使没有创建该类 ...