Hi, everyone, welcome to this new video.
So in this video, we are going to cover one question world.
So in this world later, what is the problem statement?
So you will be given one big word when and N-word and one list of words allowed.
So, for example, if the N-word is heard, so is the big N-word and the N-word is COAG.
And this is the word list.
So word list contains a list of words that are allowed.
So what you need to do, you need to convert this word, convert into the N-word and all the intermediate
word must be present in the word list.
And at one time, in one step, you can only change one character.
So, for example, first of all, I will convert hate into.
So let me see, what is this step?
So the steps are I will convert the word hurting to first of all, heart.
So I am changing ivied.
Oh, and this word heart must represent the wordlist.
So in the wordlist heart this present.
So I am converting heart into d'arte so let's convert heart into dard.
So I'm converting Ajin to be at one time.
In one step I can change only one character that is also present then dog.
So convert the G and dog is also present.
So after this what I'm going to do, I'm going to convert this DBI C so it will become COAG and COAG
is also present in the WORDLIST.
Right.
So our output will be how many words are present in this transformation sequence.
So in total five words are present, including the first word and also including the last word.
So in total, five words are there.
Right?
So we need to return the number of words that are in short text transformation sequence.
So in total, five words are there and we need to include being involved in the calculation and also
the end of the calculation.
So my answer will be five, right.
So it's very simple.
You need to convert B, convert into the and old.
Right, so Big Bird is not necessary to be present in the wordlist, it is given in the question itself,
right?
You can see it is not mandatory that begin work should be present in wordlist.
But all the intermediate rewards, all the intermediate words, including the N-word, must be present
in the wordlist and in one step.
In one step, you will change only one character.
We need to return the minimum number of words that represent present in the shortest transformation
sequence.
So I hope you understood the question.
Let's consider one more example.
So if you see in this example, example to the end of our lives, basically COAG, but the N word is
not present in the wordlist since the end, it is not wordlist.
We cannot have a transmission sequence since we cannot have a transmission sequence.
The output is zero.
Right.
So now the question is how we can solve this problem so we can easily solve this problem with the help
of BFC.
We can visualize this problem as a grave problem and we need to find out the shortest distance, short
distance and we can sequence.
So let me show you how it will look like, for example, you have had begun.
Is it?
Now, the next number can be this one hot.
The next note will be darte, then next Nade will be dog, and the last night will be COAG, right?
So each in order will store some values what each inaudible store.
So it will store one at the store.
Two, it will start retail store for it will store five.
So what we need to do, we need to just do before this before be a level of traversal and finally return
the value.
Right.
So this is BFE problem, right?
Finding out the shortest distance problem.
Now, the question is from how I'm able to reach her, so the answer is I will go to every possible
word.
For example, what do I mean by every possible word?
See, I have heard here what I am doing.
I am standing at the edge, so I will have 25 possibilities of replacing the word each word in English
alphabet.
We have 26 characters, so I can replace it with 25 other characters.
So I will get 25 different notes.
Similarly, I will replace I with 25 other characters.
I will get 25 other notes.
Similarly then, for the last character, I will replace with 25 other characters.
So I will get 25 other notes.
But out of these notes, out of these new words, for example, I'm replacing Equidae and I get an old
EIB.
It must also be present in the World List, right?
It must also be present.
Never list.
It is not present.
So I will discard this note.
Similarly, I will discard most of the notes.
Similarly, I will discard most of the notes here.
I will discard most of the notes here late.
So when I will replace I with or so I will get one note at jotty rate and heart is present and the wordlist.
So I will not discard this note.
I will consider this note and I will do, I will increase the distance, save the distance.
For this is one that I will do dist. plus plus.
So the distance will become too.
And in this way the next time.
But you have, you have heart again.
You will try to replace each with 25 other characters.
You will try to replace all with the firefighters character.
You will try to replace.
And again, you will get many, many nodes and the most other nodes will get rejected because they are
not present the novelist.
So in this way, you need to construct this graph.
And finally, when you will be able to reach the end world, you will return the value five.
Right?
So that's how you can solve this question.
I know this question is a little bit difficult.
That's true.
This question is a little bit difficult.
But we have already started to question using the fifth rate.
We have solved this night's problem and will also solve this by animatics problem.
So what you can do, you can just copy the code from here and paste the code for this problem statement
and try to modify the code.
So I will be doing I will be modifying the code in the next video, but I highly recommend that you
use the best algorithm, use the existing code and try to modify their code so that that code will work
here.
Right.
Ultimately, I will also do the same in the next video.
So, yep, that's all that I want to cover.
So I will see you in the next video with the solution.
So this is all about this device.
Thank you.
Bye bye.