把“four”变成“five”最少需要多少步?_吉林省长春市宽城区历汉困效水利水电设施股份公司

咨询服务热线

把“four”变成“five”最少需要多少步?

发布时间:{dede:field name='pubdate'function='strftime("%Y-%m-%d %H:%M:%S",@me)' /}人气:

经典的单词梯(word-ladder)问题。

各位看官日后看到这种问题直接上Mathematica。

给出的答案是六次变换: Shortest ladder length = 6 steps Path 1: four , tour , torr , tore , fore , fire , five代码如下,首先,加载词典: nWords[n_] := nWords[n] = DeleteCases[ Cases[WordData[], w_String /; StringLength[w] == n && StringMatchQ[w, RegularExpression["[a-z]+"]] && Length[WordData[w, "Definitions"]] > 0], "-Red…。

把“four”变成“five”最少需要多少步?

版权@|备案:琼-ICP备24103739号-1|网站地图 备案号:
扫一扫咨询微信客服