字符串转换

标签 string algorithm

我遇到了以下 article这让我对这个特殊问题产生了兴趣。

Given two words "CAT", "FAR" determine if you can get from the first to the second via single transformations of valid words....e.g. 1 transformation gets you from CAT to CAR changing T to R, then another gets you from CAR to FAR changing the C to F...all are valid english words.

有什么想法吗?不太确定如何开始说实话。如果你给我指出正确的方向,那就足够了。谢谢!

最佳答案

this answer 中所述(谢谢,aix),这是一个最短路径问题,可以用 A* algorithm 有效地解决使用 Hamming distance (即两个单词不同的字母数)作为启发式。

关于字符串转换,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7729666/

相关文章:

algorithm - 找到一个公共(public)子图

algorithm - 改变声音文件的速度

java - SCP内存位置中的对象

C:如何返回主要用法?

c# - 如何在 C# 中通过多字符定界符拆分字符串?

c - 在 C 中遍历字符串的首选方法是什么?

algorithm - 生成订单号的好算法

database - 从大量对象(比如一百万个字符串)中创建所有两个对象对的最佳方法是什么?

algorithm - 网络爬虫算法 : depth?

java - 输入磁盘文件并将其存储为字符串和整数