Python的open的写入方式有: write(str):将str写入文件 writelines(sequence of strings):写多行到文件,参数为可迭代对象 首先来看下writelines()这个方法: 运行上面结果之后,可以看到blogCblog.txt文件有123456内容,这里 ...
分类:
编程语言 时间:
2016-06-19 14:10:53
阅读次数:
147
题目链接:传送门 题目大意:给你两个长度均小于等于1000的字符串,你要在第一个串中找k个连续的子串,并且这些字串在第二个字符串中均出现且顺序相同,问这些字串最大的长度和。 题目思路:自己不会做,参考了大神的思路。 这个题相当于是最长公共子序列的拓展,我们用一个四维数组来转移状态,一二维表示比较第一 ...
分类:
其他好文 时间:
2016-06-18 18:37:51
阅读次数:
144
追问: 都是Linux,只是把代码移到新的Linux环境下 追问: 都是Linux,只是把代码移到新的Linux环境下 追答: 那很可能是两个系统装的C库版本不一样,毕竟C的标准库也一直在更新 追答: 那很可能是两个系统装的C库版本不一样,毕竟C的标准库也一直在更新 ...
1. 问题描述 Given two numbers represented as strings, return multiplication of the numbers as a string.Note:The numbers can be arbitrarily large and are n ...
分类:
其他好文 时间:
2016-06-16 23:22:59
阅读次数:
332
#include <stdio.h>#include <string.h>#include <strings.h>int main(){ char buf[100]; bzero(buf, 100); fgets(buf, 100, stdin); printf("%d", strlen(buf)) ...
分类:
系统相关 时间:
2016-06-16 20:04:50
阅读次数:
250
题目链接https://leetcode.com/problems/isomorphic-strings/题目原文
Given two strings s and t, determine if they are isomorphic.
Two strings are isomorphic if the characters in s can be replaced to get t....
分类:
编程语言 时间:
2016-06-16 15:01:40
阅读次数:
272
Q:
Write a function to find the longest common prefix string amongst an array of strings.
A:
这题的大概意思就是说给你一组字符串找出其中最长的哪个通用的前缀出来。这个东西不难找,但是如何找的又快又好不简单。其实这题本来就是easy题,但是却让我联想到了《数据结构与算法分析》上的一道题目,那道题目是...
分类:
编程语言 时间:
2016-06-15 16:08:24
阅读次数:
175
Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc ...
分类:
其他好文 时间:
2016-06-15 16:01:22
阅读次数:
121
Valid Anagram Given two strings s and t, write a function to determine if t is an anagram of s. For example,s = "anagram", t = "nagaram", return true. ...
分类:
其他好文 时间:
2016-06-15 15:52:23
阅读次数:
147
1. 问题描述 Given two binary strings, return their sum (also a binary string). Tags: Math String 2. 解答思路3. 代码4. 反思 ...
分类:
其他好文 时间:
2016-06-14 22:18:43
阅读次数:
136