![](https://img-blog.csdnimg.cn/20201014180756913.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
字符串
文章平均质量分 83
nudt_oys
An AC a day,keeps WA away~
展开
-
CodeForces 471D MUH and Cube Walls(KMP)
D. MUH and Cube WallsPolar bears Menshykov and Uslada from the zoo of St. Petersburg and elephant Horace from the zoo of Kiev got hold of lots of wooden cubes somewhere. They started makin原创 2016-08-16 20:08:14 · 411 阅读 · 0 评论 -
LeetCode 208 Implement Trie(实现字典树)
Implement a trie with insert, search, and startsWith methods.Note:You may assume that all inputs are consist of lowercase letters a-z.题目大意:实现Trie树的insert、search和startsWith方法。解题思路:关键在于对Trie树的原创 2017-04-29 12:13:07 · 649 阅读 · 0 评论 -
LeetCode 412 Fizz Buzz(字符串模拟)
Write a program that outputs the string representation of numbers from 1 to n.But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”. Fo原创 2017-04-05 23:04:43 · 557 阅读 · 0 评论 -
LeetCode 211 Add and Search Word - Data structure design(字典树)
Design a data structure that supports the following two operations:void addWord(word)bool search(word)search(word) can search a literal word or a regular expression string containing only letter原创 2017-04-29 17:06:15 · 513 阅读 · 0 评论 -
LeetCode 557 Reverse Words in a String III(逆转字符串)
Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order.Example 1:Input: "Let's take LeetCode contes原创 2017-04-14 19:45:33 · 708 阅读 · 0 评论 -
LeetCode 28 Implement strStr()(子字符串查找)
Implement strStr().Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack.题目大意:实现strStr(char* s, char* t)函数,该函数的作用是返回字符串t第一次出现在字符串s中的下标。解题思路:懒得写原创 2017-05-16 19:42:41 · 977 阅读 · 0 评论 -
LeetCode 606 Construct String from Binary Tree
You need to construct a string consists of parenthesis and integers from a binary tree with the preorder traversing way.The null node needs to be represented by empty parenthesis pair "()". And you原创 2017-06-29 09:11:29 · 332 阅读 · 0 评论 -
LeetCode 14 Longest Common Prefix(最长公共前缀)
Write a function to find the longest common prefix string amongst an array of strings.题目大意:写一个函数,找出一组字符串的最长公共字串。解题思路:以第一个字符串为参照,逐个比较第一个字符串的第i个字符和其他字符串的第i个字符,直到遇到不相等的字符退出循环。代码如下:char* longestCo原创 2017-07-03 19:58:54 · 648 阅读 · 0 评论 -
LeetCode 20 Valid Parentheses(用栈判断括号匹配)
Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid.The brackets must close in the correct order, "()" and "()[]{}" are all vali原创 2017-07-04 19:42:48 · 1306 阅读 · 0 评论 -
LeetCode 38 Count and Say(字符串生成)
The count-and-say sequence is the sequence of integers with the first five terms as following:1. 12. 113. 214. 12115. 1112211 is read off as "one 1" or 11.11 is read o原创 2017-07-08 08:47:08 · 2966 阅读 · 1 评论 -
LeetCode 345 Reverse Vowels of a String(字符串操作)
Write a function that takes a string as input and reverse only the vowels of a string.Example 1:Given s = "hello", return "holle".Example 2:Given s = "leetcode", return "leotcede".Note原创 2017-04-06 22:57:36 · 684 阅读 · 0 评论 -
HDOJ 1215 统计难题(字典树)
统计难题Problem DescriptionIgnatius最近遇到一个难题,老师交给他很多单词(只有小写字母组成,不会有重复的单词出现),现在老师要他统计出以某个字符串为前缀的单词数量(单词本身也是自己的前缀). Input输入数据的第一部分是一张单词表,每行一个单词,单词的长度不超过10,它们代表的是老师交给Ignatius统计的单原创 2016-12-04 20:15:28 · 457 阅读 · 0 评论 -
POJ 2752 Seek the Name, Seek the Fame(KMP)
Seek the Name, Seek the FameDescriptionThe little cat is so famous, that many couples tramp over hill and dale to Byteland, and asked the little cat to give names to their newly-born babie原创 2016-08-07 15:46:26 · 258 阅读 · 0 评论 -
POJ 3746 Cyclic Nacklace(KMP)
Cyclic NacklaceProblem DescriptionCC always becomes very depressed at the end of this month, he has checked his credit card yesterday, without any surprise, there are only 99.9 yuan left原创 2016-08-06 21:40:52 · 558 阅读 · 0 评论 -
POJ 1961 Period(KMP)
PeriodDescriptionFor each prefix of a given string S with N characters (each character has an ASCII code between 97 and 126, inclusive), we want to know whether the prefix is a periodic st原创 2016-08-05 22:24:32 · 283 阅读 · 0 评论 -
POJ 2406 Power Strings(KMP)
Power StringsDescriptionGiven two strings a and b we define a*b to be their concatenation. For example, if a = "abc" and b = "def" then a*b = "abcdef". If we think of concatenation as mult原创 2016-08-05 22:11:03 · 259 阅读 · 0 评论 -
HDOJ 2087 剪花布条(KMP)
剪花布条Problem Description一块花布条,里面有些图案,另有一块直接可用的小饰条,里面也有一些图案。对于给定的花布条和小饰条,计算一下能从花布条中尽可能剪出几块小饰条来呢? Input输入中含有一些数据,分别是成对出现的花布条和小饰条,其布条都是用可见ASCII字符表示的,可见的ASCII字符有多少个,布条的花纹也有多少种原创 2016-08-05 21:59:54 · 304 阅读 · 0 评论 -
POJ 3974 Palindrome(Manacher)
PalindromeDescriptionAndy the smart computer science student was attending an algorithms class when the professor asked the students a simple question, "Can you propose an efficient algori原创 2016-08-07 17:28:03 · 565 阅读 · 1 评论 -
HDOJ 3068 最长回文(Manacher)
最长回文Problem Description给出一个只由小写英文字符a,b,c...y,z组成的字符串S,求S中最长回文串的长度.回文就是正反读都是一样的字符串,如aba, abba等 Input输入有多组case,不超过120组,每组输入为一行小写英文字符a,b,c...y,z组成的字符串S两组case之间由空行隔开(该空行不用处理)字符串长度l原创 2016-08-09 00:10:28 · 262 阅读 · 0 评论 -
HDOJ 1841 Find the Shortest Common Superstring(KMP)
Find the Shortest Common SuperstringProblem DescriptionThe shortest common superstring of 2 strings S1 and S2 is a string S with the minimum number of characters which contains both S1 a原创 2016-08-05 21:53:19 · 308 阅读 · 0 评论 -
CCF CSP 2014年9月第3题 字符串匹配(strstr函数的应用)
问题描述试题编号:201409-3试题名称:字符串匹配时间限制:1.0s内存限制:256.0MB问题描述:问题描述 给出一个字符串和多行文字,在这些文字中找到字符串出现的那些行。你的程序还需支持大小写敏感选项:当选项打开时,表示同一个字母的大写和小写看作不同的字符;原创 2017-10-02 19:39:53 · 993 阅读 · 0 评论