Given two strings S and T, determine if they are both one edit distance apart.
分析:one edit distance,要么S,T长度相同, 只有一对不同char,那么只要跳过这对不同的char,应该能匹配完两个String的;...
分类:
其他好文 时间:
2015-07-20 19:46:52
阅读次数:
107
旧类以调用未绑定的超类构造方法
class OldDog:
def __init__(self):
print 'I am a old dog !'
self.__hungry = True
def eat(self):
if self.__hungry:
print 'I eat it !'
...
分类:
编程语言 时间:
2015-07-18 17:11:52
阅读次数:
180
//
// main.m
// 继承
//
//
#import
#import "Animal.h"
#import "Cat.h"
#import "Dog.h"
#import "FeedMan.h"
int main(int argc, const char * argv[])
{
// Animal * animal = [Animal new];
// ...
分类:
移动开发 时间:
2015-07-18 14:05:40
阅读次数:
230
Edit Distance
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.)
You have the following 3 op...
分类:
其他好文 时间:
2015-07-17 18:54:56
阅读次数:
191
2dx3.0下一个JSON解析库官员以及集成。我们参考一下吧OK。JSON文件hello.json内容{"pets":["dog","cat"],"stuInfo":{"stuAge":"23","stuName":"zhangsan","birthday":"1990-01-12"},"usern...
分类:
Web程序 时间:
2015-07-17 13:31:03
阅读次数:
157
题目传送门 1 /* 2 题意:bob按照指定顺序行走,他的狗可以在他到达下一个点之前到一个景点并及时返回,问狗最多能走多少个景点 3 匈牙利算法:按照狗能否顺利到一个景点分为两个集合,套个模板 4 */ 5 #include 6 #include 7 #inclu...
分类:
编程语言 时间:
2015-07-16 21:58:05
阅读次数:
148
072 Edit Distance纯dp 解法, 唯一可以优化的就是空间复杂度了,以下代码没有优化。。。class Solution: # @param {string} word1 # @param {string} word2 # @return {integer} de...
分类:
其他好文 时间:
2015-07-15 14:58:13
阅读次数:
81
关于词语接龙,能否把所有的单词首尾连接起来(串成一条线即可,不需要围成环)
2
6
aloha
arachnid
dog
gopher
rat
tiger
3
oak
maple
elm
为什么返回值是0;而不是 n..第一个完全可以首尾相连啊。求解答啊
#include
#include
#include
using namespace std;
vectormap[30];
int...
分类:
其他好文 时间:
2015-07-14 11:37:20
阅读次数:
126
在分类聚类算法,推荐系统中,常要用到两个输入变量(通常是特征向量的形式)距离的计算,即相似性度量.不同相似性度量对于算法的结果,有些时候,差异很大.因此,有必要根据输入数据的特征,选择一种合适的相似性度量方法。
令X=(x1,x2,..,xn)T,Y=(y1,y2,...yn)T为两个输入向量,
1.欧几里得距离(Euclidean distance)-EuclideanDistance...
分类:
其他好文 时间:
2015-07-12 23:23:09
阅读次数:
957
__author__ = 'hualong_zhang'
# -*- coding:utf-8 -*-
import sys
reload(sys)
sys.setdefaultencoding('utf-8')
init_list_1 = [1, 4, 9, 'cat', 'dog', 'dog', 'bird', ['fish']]
init_list_2 = [1, 4, 9]
prin...
分类:
编程语言 时间:
2015-07-10 15:15:46
阅读次数:
210