随笔分类 -  字符串

摘要:1. 暴力 时间复杂度O(n^3)。 2. 延展 以某一字符为中心,设置left, right两个变量同时向外扩,判断他们指向字符是否相同。注意分奇偶讨论。时间复杂度O(n^2)。 3. Manacher 马拉车 代码注释: 1 const int MAXN = 110009; 2 char ma[ 阅读全文
posted @ 2021-01-23 21:06 Daybreaking 阅读(145) 评论(0) 推荐(0)
摘要:1 #include <cstdio> 2 #include <cstdlib> 3 #include <cstring> 4 #include <cmath> 5 #include <algorithm> 6 #include <queue> 7 #include <stack> 8 #inclu 阅读全文
posted @ 2019-10-24 15:58 Daybreaking 阅读(136) 评论(0) 推荐(0)
摘要:To stay woke and attentive during classes, Karen needs some coffee! Karen, a coffee aficionado, wants to know the optimal temperature for brewing the 阅读全文
posted @ 2018-10-06 09:42 Daybreaking 阅读(260) 评论(0) 推荐(0)
摘要:算法思想:失之东隅,收之桑隅 对于一个序列,它正向最长上升子序列的长度就是它反向最长下降子序列的个数。 1 #include<stdio.h> 2 #include<stdlib.h> 3 #include<string.h> 4 #include<math.h> 5 #include<algori 阅读全文
posted @ 2018-08-09 21:31 Daybreaking 阅读(173) 评论(0) 推荐(0)
摘要:给出两个字符串A B,求A与B的最长公共子序列(子序列不要求是连续的)。 比如两个串为: abcicba abdkscab ab是两个串的子序列,abc也是,abca也是,其中abca是这两个字符串最长的子序列。 Input 第1行:字符串A 第2行:字符串B (A,B的长度 <= 1000) Ou 阅读全文
posted @ 2018-07-28 11:24 Daybreaking 阅读(308) 评论(0) 推荐(0)