一.两个难点算法

1.Manacher算法,线性时间求最长回文子串

2.KMP算法,字符串匹配问题,c语言中的strStr

二.几个题目

1.最长回文子串

方法:暴力,动态规划,中心扩展,manacher

参考:

http://blog.163.com/zhaohai_1988/blog/static/2095100852012716105847112/

2.最长回文子序列

3.最长公共子序列

4.最长公共子串

[string]字符串中几个比较难的算法和容易搞混的题目的更多相关文章

  1. String 字符串中含有 Unicode 编码时,转为UTF-8

    1.单纯的Unicode 转码 String a = "\u53ef\u4ee5\u6ce8\u518c"; a = new String(a.getBytes("UTF ...

  2. 将string字符串中的换行符进行替换

    /** * 方法名称:replaceBlank * 方法描述: 将string字符串中的换行符进行替换为"" * */ public static String replaceBl ...

  3. [LeetCode] Number of Segments in a String 字符串中的分段数量

    Count the number of segments in a string, where a segment is defined to be a contiguous sequence of ...

  4. [CareerCup] 1.1 Unique Characters of a String 字符串中不同的字符

    1.1 Implement an algorithm to determine if a string has all unique characters. What if you cannot us ...

  5. [LeetCode] Add Bold Tag in String 字符串中增添加粗标签

    Given a string s and a list of strings dict, you need to add a closed pair of bold tag <b> and ...

  6. [LeetCode] Permutation in String 字符串中的全排列

    Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. I ...

  7. String:(字符串)中常用的方法

    package stringyiwen; //字符串中常用的方法public class StringTest03 { public static void main(String[] args) { ...

  8. 434 Number of Segments in a String 字符串中的单词数

    统计字符串中的单词个数,这里的单词指的是连续的非空字符.请注意,你可以假定字符串里不包括任何不可打印的字符.示例:输入: "Hello, my name is John"输出: 5 ...

  9. [LeetCode] 567. Permutation in String 字符串中的全排列

    Given two strings s1 and s2, write a function to return true if s2 contains the permutation of s1. I ...

随机推荐

  1. 常用SQL Server分页方式

    假设有表ARTICLE,字段ID.YEAR...(其他省略),数据53210条(客户真实数据,量不大),分页查询每页30条,查询第1500页(即第45001-45030条数据),字段ID聚集索引,YE ...

  2. ASP.NET通用权限组件实现一

    沙发(SF)通用权限验证组件 开篇 上一篇提到了通用权限的设计思路,根据设计思路一步一步的来实现一个相对通用的权限验证组件.在VS2010下用C#语言基于.net framework2.0框架实现具体 ...

  3. linux定时执行

    /root/crontab-conf文件为root用户定时执行计划文件      命令:crontab -l 说明:列出定时执行的计划列表   命令:crontab -e 说明:编辑定时执行的计划文件 ...

  4. Activity之间的跳转

    /* * 触发按钮bt1跳转到另一个Activity */ bt1.setOnClickListener(new OnClickListener() { @Override public void o ...

  5. Ubuntu安装tftp服务器

    一.安装如下软件包: sudo apt-get install xinetd tftpd tftp 二.在/etc/xinetd.d/目录下创建tftp文件,并输入如下内容. 执行命令:sudo vi ...

  6. IE10以下placeholder不兼容

    做页面的时候在谷歌中是显示的,但是换了IE之后总是不显示,一个文本框还好,如果有多个的话,如图: 添加以下一段Jquery代码: <script> var JPlaceHolder = { ...

  7. 移动网页版Meta 标签

    viewport 大部分移动浏览器都接受,比如 Opera Mobile, iPhone, Android, Iris, IE, BlackBerry, Obigo, Firefox 最基本的例子,在 ...

  8. 使用pymysql连接MySql数据库

    MySQLdb安装失败了,直接使用pymysql,安装了pymysql. 并学习了使用使用pymysql创建数据库和表,并插入数据. __author__ = 'Administrator' impo ...

  9. mysql 根据规定的数组进行排序

    最近在开发中遇到一个问题,我要根据一组商品的佣金进行排序和分页,可是佣金并不在商品表中,于是我就只能通过数组的操作把佣金计算出来,然后通过array_multisort()方法进行排序,可是无法做到分 ...

  10. 元器件选型(一)ESD、TVS参考资料

    许多开发人员都遇到过这样的情况:在实验室开发好的产品,测试完全通过,但到了客户手里用了一段时间之后,出现异常现 象,甚至是产品失效需要返修,并且故障率往往也不高(1%以下).一般情况下,以上问题大都由 ...