1、中心扩展中心扩展就是把给定的字符串的每一个字母当做中心,向两边扩展,这样来找最长的子回文串。算法复杂度为O(N^2)。但是要考虑两种情况:1、像aba,这样长度为奇数。2、想abba,这样长度为偶数。代码如下:string findLongestPalindrome(string &s){ .....
分类:
其他好文 时间:
2015-06-10 00:55:24
阅读次数:
159
就String而言,平时工作中用得最多,但是很多时候还是用不好,有必要对他进行整体的分析下。如果看过Thinking in java,再看下JDK的源码,很多东西就会变得十分明了。现在对String的底层实现进行下分析。 首先是对构造函数而言,我工作中最常用到的可能就是new String(str....
分类:
其他好文 时间:
2015-06-10 00:52:38
阅读次数:
145
添加jar包 dom4j.jar jaxen.jar //String转XML String xmlStr="111zsztaiping"; Document document = DocumentHelper.parseText(xmlStr); Element root=doc...
分类:
其他好文 时间:
2015-06-10 00:50:17
阅读次数:
191
Basic CalculatorImplement a basic calculator to evaluate a simple expression string.The expression string may contain open(and closing parentheses), t...
分类:
编程语言 时间:
2015-06-10 00:50:16
阅读次数:
399
关于连加和连减:http://blog.csdn.net/ieayoio/article/details/46431843
下面是一段普遍都了解的代码:
public static void main(String[] args) {
int a=3;
System.out.println(a++ +1);//4
System.out.println(a);//4
System...
分类:
编程语言 时间:
2015-06-09 23:47:01
阅读次数:
717
用法: //声名一个数据集合 var listString = new List() { "a", "b", "c" }; //缓存key string key = "cokey"; //获取实例 ...
using System;namespace Test{ public delegate void TryDelegate(string name); public class SayHello{ public void SpeakChinese(string name...
class Program { static void Main(string[] args) { var array = new[] { 11, 3, 24, 5, 0, 2, 4, 6, -1, 101, 101, 5 }; ...
分类:
编程语言 时间:
2015-06-09 23:20:59
阅读次数:
129
VisualStudio 2010 SP1环境1、设置string默认编码为utf8,只需要在文件头部加入以下代码1 #pragma execution_character_set("utf-8") //默认使用UTF82、debug提示窗口显示utf8,打开C:\Program Files (x8...
分类:
其他好文 时间:
2015-06-09 23:14:05
阅读次数:
1802
用法: //声名一个数据集合 var listString = new List() { "a", "b", "c" }; //session key string key = "sekey"; //获取实例...