原题地址:https://oj.leetcode.com/problems/anagrams/题意:Given
an array of strings, return all groups of strings that are anagrams.Note: All
inputs will be i...
分类:
编程语言 时间:
2014-06-29 13:25:28
阅读次数:
355
题目
Write a function to find the longest common prefix string amongst an array of strings.
原题链接
解题思想
给一个字符串数组,求这些字符串的最长公共前缀。
这个题应该是比较简单的,直接写代码,一次AC。解题思想是依次对数组中的字符串求最长公共前缀。
代码实现
class Sol...
分类:
其他好文 时间:
2014-06-20 12:25:09
阅读次数:
247
链接: http://acm.hrbust.edu.cn/index.php?m=ProblemSet&a=showProblem&problem_id=2113
Description
Given a number of strings, can you find how many strings that appears T times?
Input
The input conta...
分类:
编程语言 时间:
2014-06-20 09:00:14
阅读次数:
344
戳我去解题Given an array of strings, return all
groups of strings that are anagrams.Note: All inputs will be in
lower-case.Anagram(回文构词法)是指打乱字母顺序从而得到新的单词回文...
分类:
其他好文 时间:
2014-06-10 08:44:13
阅读次数:
275
戳我去解题Write a function to find the longest
common prefix string amongst an array of strings.class Solution {public: string
longestCommonPrefix(vecto...
分类:
其他好文 时间:
2014-06-10 08:29:55
阅读次数:
189
一次总结两道题,两道题目都比较基础Description:Write a function to
find the longest common prefix string amongst an array of strings.分析:
这道题目最重要的知道什么叫prefix前缀, 否则一不小心就做...
分类:
其他好文 时间:
2014-06-09 21:08:16
阅读次数:
224
原题地址:https://oj.leetcode.com/problems/add-binary/题意:Given
two binary strings, return their sum (also a binary string).For example,a ="11"b
="1"Return"...
分类:
编程语言 时间:
2014-06-08 20:28:04
阅读次数:
300
字符串和字符A string is an ordered collection of
characters, such as "hello, world" or "albatross". Swift strings are represented
by the String type, which ...
分类:
其他好文 时间:
2014-06-08 19:43:21
阅读次数:
247
字符串和字符 (Strings and Characters)String是一个有序的字符集合,例如
"hello, world", "albatross"。Swift 字符串通过String类型来表示,也可以表示为Character类型值的集合。Swift
的String和Character类型提...
分类:
其他好文 时间:
2014-06-08 00:24:00
阅读次数:
381
题目来源:Light OJ 1268 Unlucky Strings
题意:给你一些可以用的字符 然后求组成不包含给定字符串的方案数
思路:矩阵经典问题 从i走k步路到达j的方案数 可以用矩阵快速幂求解
对于求长度为n的字符的方案数 就是走n步路 求走法
可以用KMP求出走一步 从前i个字符到前j个字符的方案数 这点有点不好理解 想一想
#include
#include
#...
分类:
其他好文 时间:
2014-06-07 14:33:43
阅读次数:
303