随笔分类 -  字符串处理/ hash

摘要:Problem Statement You are given a string S consisting of digits between 1 and 9, inclusive. You can insert the letter + into some of the positions (po 阅读全文
posted @ 2019-04-15 20:47 茄子Min 阅读(267) 评论(0) 推荐(0)
摘要:Palindromic characteristics of string s with length |s| is a sequence of |s|integers, where k-th number is the total number of non-empty substrings of 阅读全文
posted @ 2019-02-27 21:48 茄子Min 阅读(321) 评论(0) 推荐(0)
摘要:The main city magazine offers its readers an opportunity to publish their ads. The format of the ad should be like this: There are space-separated non 阅读全文
posted @ 2019-01-09 15:36 茄子Min 阅读(318) 评论(0) 推荐(0)
摘要:题目链接 题意: 给定一个字符串,最多更改一个字符,问最多可以有多少个“VK”子串? 思路: 由于数据量很小,不妨尝试暴力写。首先算出不更改任何字符的情况下有多个VK字串,然后尝试每一次更改一个位置的字符,然后暴力算出有多少个VK,取出这些答案中 的最大值,即是答案。 代码: 阅读全文
posted @ 2019-01-07 23:22 茄子Min 阅读(216) 评论(0) 推荐(0)
摘要:题目链接 时间复杂度 O(n*n*|s| ) 纯暴力,通过string.substr()函数来构造每一个字符串平移后的字符串。 阅读全文
posted @ 2019-01-06 20:37 茄子Min 阅读(259) 评论(0) 推荐(0)
摘要:题目链接 题意:英语很简单,自己取读吧。 思路: 既然n和i字符串的长度都很小,最大才50,那么就是只要能出答案就任意暴力瞎搞。 本人本着暴力瞎搞的初衷,写了又臭又长的200多行(代码框架占了50行)。反正不忘初衷就对了。 暴力:枚举每一个字符串,然后暴力去算其他字符串变成该字符串需要用多少步骤,然 阅读全文
posted @ 2019-01-06 17:23 茄子Min 阅读(180) 评论(0) 推荐(0)
摘要:题目链接 一个简单的题目,但是却很少有人可以一次AC,比如我就瞎写wa了一次。。。 写本博算个教训录吧。 题目给出一个字符串,让你严格的改变一个字符使改变后的字符串是一个回文串。 回文串不用解释了。不懂自行百度。 需要注意两点: 1.如果长度为偶数,并且事先就是一个回文串,那么要输出no的,因为必须 阅读全文
posted @ 2019-01-06 15:56 茄子Min 阅读(194) 评论(0) 推荐(0)
摘要:题目链接 题目难度: 1700rating 题目类型:string+贪心+STL 题目思路: 由于题目要求的最终结果是字典序最小的那个字符串,那么我们从贪心的从’a’开始查找字符串里是否存在,如果存在,就先把后面的所有的该字符放在答案字符串u中(u可以用queue来表示),而字符串t可以用stack 阅读全文
posted @ 2019-01-06 00:04 茄子Min 阅读(174) 评论(0) 推荐(0)