Given two strings S and T, determine if they are both one edit distance apart.用i, j 两个指针,从左边扫到右边,两个一起走。s.charAt(i) != t.charAt(j)distance++要么i跳一格,要么j跳...
分类:
其他好文 时间:
2015-01-24 06:44:38
阅读次数:
152
Write a function to find the longest common prefix string amongst an array of strings.
题意:求字符串数组的最长公共前缀
思路:首先找到最短的那个作为标尺,然后每次比较。
class Solution {
public:
string longestCommonPrefix(vector &st...
分类:
其他好文 时间:
2015-01-23 21:38:51
阅读次数:
147
本篇源自py2.7.9-docs的faq.pdf中的“3.23Whycan’trawstrings(r-strings)endwithabackslash?”更准确的说,原始字符串即以r修饰的字符串,不能以奇数个反斜杠结束;原始字符串被设计用来作为一些处理器(主要是正则表达式引擎)的输入。这种处理器会认为这种未匹配的末端反斜杠..
分类:
编程语言 时间:
2015-01-23 18:33:14
阅读次数:
201
Copied from http://www.mssqltips.com/sqlservertip/1771/splitting-delimited-strings-using-xml-in-sql-server/DECLARE @t TABLE ( ID INT IDENTITY ,...
分类:
其他好文 时间:
2015-01-22 17:45:02
阅读次数:
179
https://oj.leetcode.com/problems/longest-palindromic-substring/Given a stringS, find the longest palindromic substring inS. You may assume that the ma...
分类:
其他好文 时间:
2015-01-22 17:24:11
阅读次数:
105
strings.go包实现了一个Rabin-Karp算法.有点意思.
关于这个算法:
图灵社区的有一篇: 图说Rabin-Karp字符串查找算法
关于Go源码实现:
网友GoLove已写一个篇非常详细的说明了. http://www.cnblogs.com/golove/p/3234673.html
GoLove那个已经分析的非常清楚了,只是前面那一串说明太长了.我...
分类:
编程语言 时间:
2015-01-22 13:18:40
阅读次数:
223
题意:给你一个字符串,然后找多少区间内含有“bear”,输出数目; 1 #include 2 #include 3 #include 4 using namespace std; 5 6 char str[5001]; 7 int pos[50001]; 8 9 int main()10 ...
分类:
其他好文 时间:
2015-01-22 10:41:37
阅读次数:
102
DescriptionYou are given a number of case-sensitive strings of alphabetic characters, find the largest string X, such that either X, or its inverse ca...
分类:
其他好文 时间:
2015-01-20 20:27:10
阅读次数:
191
用过strings.NewReplacer,replacer.Replace(),它按对传入参数后,能依优先级替换,并能处理中文字符串参数.
觉得功能强大,特别好用.对它的查找和优先级怎么处理有点兴趣,花时间研究了下源码,在这记录一下个人理解.
package main
//author:xcl
//2014-1-20 记录
import (
"fmt"
"strings"...
分类:
编程语言 时间:
2015-01-20 15:46:20
阅读次数:
143
# /res/values 目录详解------**/res/values** 下可以放置的文件有:> * strings.xml > * arrays.xml > * dimens.xml > * colors.xml > * styles.xml### 绘制表格| 文件类型 |作用|temp| ...
分类:
其他好文 时间:
2015-01-19 22:40:20
阅读次数:
378