题目一:根据电话上字母和数字的对应关系,用一个有意义的单词来表述一个电话号码,如用computer表示26678837
题目二:反过来,给定一个电话号码,是否可以用一个单词来表示呢?怎样表示最快呢?显然不是所有的电话号码都可以对应到单词上去
首先来看看leetcode上一个类似的题目:
Letter Combinations of a Phone Number
G...
分类:
其他好文 时间:
2014-08-15 16:11:50
阅读次数:
257
hdu 4929 Another Letter Tree(LCA+DP)
题意:有一棵树n个节点(n
解法:一个很直观的想法,求出lca(设其为w)后,枚举x,求出a到w的路径上,能匹配s0的x长度前缀的情况有多少种,令其为c[x]。再求出b到w的路径上能匹配s0的L-x(L表示s0的长度)长度后缀的情况有多少种,令其为d[l-x],那么将所有的c[x]*d[l-x](x属于[0,l]...
分类:
其他好文 时间:
2014-08-13 10:38:05
阅读次数:
346
Problem StatementThe Happy Letter game is played as follows: At the beginning, several players enter the field. Each player has a lowercase English le...
分类:
移动开发 时间:
2014-08-13 03:33:35
阅读次数:
201
基本的编程能力考查。
注意:
1 下标处理
2 审查题意,并严格根据题意去重。
3 如何把代码写清晰精简。
#include
#include
const short MAX_LETTER = 21;
const short ALP_LEN = 26;
short Letter[ALP_LEN] = {-1, 1, 2, 3, -1, 1, 2, -1, -1, 2, 2, 4, 5...
分类:
其他好文 时间:
2014-08-06 14:58:32
阅读次数:
238
Given a digit string, return all possible letter combinations that the number could represent.A mapping of digit to letters (just like on the telephon...
分类:
其他好文 时间:
2014-08-06 14:30:21
阅读次数:
213
题目:Given two words (start and end), and a dictionary, find all shortest transformation sequence(s) from start to end, such that:Only one letter can b....
分类:
编程语言 时间:
2014-08-06 01:52:30
阅读次数:
251
题目:Given two words (start and end), and a dictionary, find the length of shortest transformation sequence from start to end, such that:Only one letter...
分类:
编程语言 时间:
2014-08-06 01:35:30
阅读次数:
389
Description
Let x and y be two strings over some finite alphabet A. We would like to transform
x into y allowing only operations given below:
Deletion: a letter in x is missing in y at a corr...
分类:
其他好文 时间:
2014-08-05 19:32:50
阅读次数:
247
The Most Wanted LetterYou are given a text, which contains different english letters and punctuation symbols. You should find the most frequent letter...
分类:
其他好文 时间:
2014-08-05 10:41:10
阅读次数:
276
Pythonbreak语句Pythonbreak语句,就像在C语言中,打破了最小封闭for或while循环。break语句用来终止循环语句,即循环条件没有False条件或者序列还没被完全递归完,也会停止执行循环语句。break语句用在while和for循环中。如果您使用嵌套循环,break语句将停止执行最深层的循环..
分类:
编程语言 时间:
2014-08-05 03:11:59
阅读次数:
403