- 1

can you solve this problem to me?🙏🙏🙏

There is a complete list of words in the Academy of Letters of England. The academy believes that words have changed over time. For example, in a century, a letter of a word has changed and created a new word. This action is called mutation. Now they need a program that can calculate the number of start word jumps to reach the target word based on an array of words, receiving a start word and a target word. Input: Integer and positive number n and then n number of words and finally the word start and end Output: A positive integer as the number of mutations Notes: The length of all array words is the same. The start word and the destination word are distinct. The goal is to find the length of the shortest conversion sequence. Words are made up of lowercase English letters only. Only one letter changes in each conversion. Every converted word, including the target word, must be in the list. The start word can be in the list, it can not be. If no path is found, return 0.

3rd Mar 2022, 9:50 AM
AmirhosseinYazdani
AmirhosseinYazdani - avatar
2 Answers
0
Can't really do this without the "list" of acceptable words.... Ignoring that, psuedocode is: identify the size of the input word, count shared characters between start and target, output result of (size- shared) Eg input: texts target: rests size: 5 matching: _ e _ t s =3 {EDIT: check for matching, not shared} result: 5-3=2 Do we need to check the word list for: tests, rests? {Edit2: immediately fail if target is not in the list}
3rd Mar 2022, 10:19 AM
HungryTradie
HungryTradie - avatar
0
yes we need list
3rd Mar 2022, 10:26 AM
AmirhosseinYazdani
AmirhosseinYazdani - avatar