Reby


  • 首页

  • 分类

  • 关于

  • 归档

  • 标签

括号匹配

发表于 2016-06-12   |   分类于 Algorithm   |  

logo

阅读全文 »

最短前缀

发表于 2016-06-12   |   分类于 Algorithm   |  

Shortest Prefixes

Description

A prefix of a string is a substring starting at the beginning of the given string. The prefixes of “carbon” are: “c”, “ca”, “car”, “carb”, “carbo”, and “carbon”. Note that the empty string is not considered a prefix in this problem, but every non-empty string is considered to be a prefix of itself. In everyday language, we tend to abbreviate words by prefixes. For example, “carbohydrate” is commonly abbreviated by “carb”. In this problem, given a set of words, you will find for each word the shortest prefix that uniquely identifies the word it represents.

阅读全文 »
1…67
Rui

Rui

Never stand still

62 日志
10 分类
48 标签
© 2016 Rui
由 Hexo 强力驱动
主题 - NexT.Mist