Hi, everyone.
So in this video, we are going to write the code for the problem that we have discussed in our last
video and like, how is the input given to us?
So basically, this is nothing but the X coordinate area and this is the Y coordinate area.
So this is our first point, which is zero zero.
This is the second point, which is when Gormogon and this is the third point when compared to.
So the approach was very clear, what will do?
We will take the defense, so defense of one and zero is basically one defense off one and zero is basically
one and will take the maximum.
So maximum is one.
Similarly, for these two, defense of one and one is basically zero difference of two and one is basically
one will take the maximum, which is one.
And then we will add these two values and output will be two.
So the answer is to what we are doing.
We are taking the defense off, excluding it extra minus X1 and the absolute defense rate.
We want positive value and we are taking the absolute defense of y coordinate value minus one.
And finally, what will do?
We will take the maximum out of two.
We are taking the maximum.
So one 11 maximum is one zero and one maximum is one.
We are taking the maximum.
OK, simple, right.
So now let's start writing the code.
So basically, we are given two areas, let me.
Zoom it so we are giving it to Eddie and they will contain the extraordinary in my coordinates or better
let us rename the stadium.
So this is extraordinary and this is why coordinate and what we need to do, we need to return them
in a number of steps.
So initially the count of the number of steps is zero and now the solution is very easy.
We just need to it already.
Eddie, let's say I am starting from one.
And I less than X darte size.
And I placeless.
What we need to do, we need to take that difference off X coordinated by coordinated so and we need
to take the maximum out of them.
So maximum of.
We undertake absolute defense.
Difference affects coordinated, very coordinated, so Zulfi.
Minus of, i.e., minus one.
The second value is basically the absolute difference of right coordinates, so why a minus Y of a.
Minus one.
Simple, right?
And what we need to do, we need to add this value to count so count plus equals to this value and that's
it.
So this is all that we need to do.
And finally, we will return the minimum number of steps, which is count.
So this is all that we need to do here, right?
Very simple.
Now, let's submit.
OK, so basically our solution is to have a solution past all the test cases.
OK, so that is how you will be able to write the code for this problem.
So this is from this video.
I will see you in the next one.
Thank you.