Given two numbers represented as strings, return multiplication of the numbers as a string.Note: The numbers can be arbitrarily large and are non-nega...
分类:
其他好文 时间:
2014-07-12 00:15:07
阅读次数:
268
由于某个需求,需要如题的转换,废话不多说,直接贴代码了,其实挺丑了,备用了func (this *Server) socketParserHandler(client *genTcpServer.Client, fullData []byte) { fmt.Println("original ...
分类:
其他好文 时间:
2014-07-09 15:33:31
阅读次数:
150
反转一个字符串
>>> S = 'abcdefghijklmnop'
>>> S[::-1]
'ponmlkjihgfedcba'
这种用法叫做three-limit slices
除此之外,还可以使用slice对象,例如
>>> 'spam'[slice(None, None, -1)]
>>>
unicode码与字符(single-character strings)之间...
分类:
编程语言 时间:
2014-07-09 13:08:50
阅读次数:
212
Power Strings
Time Limit: 3000MS
Memory Limit: 65536K
Total Submissions: 31111
Accepted: 12982
Description
Given two strings a and b we define a*b to be their concate...
分类:
其他好文 时间:
2014-07-09 11:11:53
阅读次数:
155
usingSystem;
usingSystem.Collections.Generic;
usingSystem.Linq;
usingSystem.Text;
usingSystem.Threading.Tasks;
namespaceConsoleApplication2
{
classProgram
{
staticvoidMain(string[]args)
{
catc=newcat("萌萌");//先执行cat(strings,inti)构造函数
Console.WriteLi..
分类:
其他好文 时间:
2014-07-09 08:05:19
阅读次数:
184
Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a ...
分类:
其他好文 时间:
2014-07-08 21:44:23
阅读次数:
177
Write a function to find the longest common prefix string amongst an array of strings.
写一个函数找出字符串数组中的最长共现前缀字符串。
思路:共现,即要求数组中的所有元素的前缀中都要出现。所以所得的结果肯定是最短字符串的部分或全部或都不是,总之要以最短字符串为基准与其他字符串比较。
public Str...
分类:
其他好文 时间:
2014-07-08 10:39:49
阅读次数:
203
Swift学习——使用if和switch来进行条件操作,使用for,while,和do-while来进行循环
//switch支持任意类型的数据以及各种比较操作——不仅仅是整数以及测试相等
//注意如果去掉default程序会报错
let strings = "hello3"
switch strings{
case "hello1":
let stringsCo...
分类:
其他好文 时间:
2014-07-06 12:41:35
阅读次数:
186
本代码是在python2.*上边所写。
功能:在指定目录下查找特定文件夹下的特定文件。
实例:查找在packages目录下文件夹名为values下的strings.xml文件
#!/usr/bin/env python
import os
def walk_dir(path):
filter_file_name = 'strings.xml'
for root...
分类:
编程语言 时间:
2014-07-06 10:48:18
阅读次数:
202
题目:给你一个目标串,和一些模式串,问每个模式串是否在目标串中出现。
分析:字符串,AC自动机。一开始用KMP算法,TLE了才发现会超时,改用AC自动机;
直接利用AC自动机存储,查询即可,然后按顺序输出;
如果模式串中有重复的,直接利用并查集合并即可,朱旭判断父节点。
说明:╮(╯▽╰)╭计算复杂度时,数据组数被忽略了;注意初始化。
#i...
分类:
其他好文 时间:
2014-07-06 10:46:17
阅读次数:
224