昨天做了leetcode里的 Longest Palindromic Substring ,一开始用动态规划O(N^2),不管怎么改都超时了。。。于是在大神的帮助下,找到了传说中的Manacher算法,居然能在O(n)内求出来,瞬间给跪了。
本屌认为,这个算法主要是充分的利用了以前的匹配的结果,来起到了降低时间复杂度的作用,这点跟KMP算是有点类似。在预处理时有个小技巧就是将第0,1为设...
分类:
其他好文 时间:
2014-06-20 12:15:22
阅读次数:
305
timeZoneAbbreviation = @“America/New_York”;#pragma
mark - 转换时区- (NSDate *) convertDate:(NSDate *) date toTimeZone:(NSString *)
timeZoneAbbreviation { ...
分类:
其他好文 时间:
2014-06-07 07:46:59
阅读次数:
183
string
sql="";dbhelper.ExecuteNonQuery(sql);DataTable dt =
dbhelper.GetDataTable(sql);if (dt != null && dt.Rows.Count > 0){
SqlBulkCopy bcp = new SqlB...
分类:
数据库 时间:
2014-06-07 07:17:20
阅读次数:
229
public static void WriteLog(string msg) { string
appPath = AppDomain.CurrentDomain.BaseDirectory; string ServerPath = appPath +
@"\Log" + DateTime.No....
分类:
其他好文 时间:
2014-06-07 07:15:18
阅读次数:
292
玩了一下mybatis,网上源码说的不太清楚。自己写了一下。希望对大家有用(spring3+mybatis3+mysql)实体类:package
org.my.entity;public class User { private Integer id; private String na...
分类:
数据库 时间:
2014-06-07 07:14:07
阅读次数:
318
Demo:Login1.创建一个UserLogin类。package com{ [Bindable]
public class UserLogin { public var logUserNam:String=""; //用户名 public va...
分类:
其他好文 时间:
2014-06-07 06:57:42
阅读次数:
235
StringBuilder s = new StringBuilder();
s.Append(""); Type cstype = this.GetType(); ClientScriptManager cs =
Page.ClientScript; string sname = "lt"; if...
分类:
Web程序 时间:
2014-06-07 06:54:53
阅读次数:
318
Warning: Format string is not a string literal
(potentially insecure)[objc]view
plaincopyNSString*str=nil;str=[NSStringstringWithFormat:@"---%d---",18...
分类:
其他好文 时间:
2014-06-07 06:52:53
阅读次数:
263
1 /// 2 /// RSA加密 3 /// 4 /// 5 /// 6 /// 7 public
string RsaEncrypt(string strPublickey, s...
分类:
其他好文 时间:
2014-06-07 06:50:15
阅读次数:
192
本文转自:http://www.cnblogs.com/promic/archive/2010/04/21/1717190.htmlprivate static
string strConnect = System.Configuration.ConfigurationManager.AppSett...
分类:
Web程序 时间:
2014-06-07 06:26:52
阅读次数:
241