1 00:00:01,230 --> 00:00:02,050 Hi, everyone. 2 00:00:02,070 --> 00:00:06,870 So in this video, we are going to write the code for the problem that we have discussed in our last 3 00:00:06,870 --> 00:00:10,480 video and like, how is the input given to us? 4 00:00:10,500 --> 00:00:15,170 So basically, this is nothing but the X coordinate area and this is the Y coordinate area. 5 00:00:15,420 --> 00:00:18,410 So this is our first point, which is zero zero. 6 00:00:18,720 --> 00:00:23,130 This is the second point, which is when Gormogon and this is the third point when compared to. 7 00:00:24,620 --> 00:00:26,960 So the approach was very clear, what will do? 8 00:00:26,960 --> 00:00:33,170 We will take the defense, so defense of one and zero is basically one defense off one and zero is basically 9 00:00:33,170 --> 00:00:34,850 one and will take the maximum. 10 00:00:34,850 --> 00:00:35,760 So maximum is one. 11 00:00:36,080 --> 00:00:42,200 Similarly, for these two, defense of one and one is basically zero difference of two and one is basically 12 00:00:42,200 --> 00:00:44,270 one will take the maximum, which is one. 13 00:00:44,570 --> 00:00:47,390 And then we will add these two values and output will be two. 14 00:00:47,750 --> 00:00:49,790 So the answer is to what we are doing. 15 00:00:49,790 --> 00:00:55,760 We are taking the defense off, excluding it extra minus X1 and the absolute defense rate. 16 00:00:55,770 --> 00:01:02,000 We want positive value and we are taking the absolute defense of y coordinate value minus one. 17 00:01:02,510 --> 00:01:03,800 And finally, what will do? 18 00:01:03,800 --> 00:01:06,130 We will take the maximum out of two. 19 00:01:07,400 --> 00:01:08,720 We are taking the maximum. 20 00:01:08,720 --> 00:01:12,590 So one 11 maximum is one zero and one maximum is one. 21 00:01:12,800 --> 00:01:14,360 We are taking the maximum. 22 00:01:15,080 --> 00:01:16,200 OK, simple, right. 23 00:01:16,550 --> 00:01:18,650 So now let's start writing the code. 24 00:01:21,640 --> 00:01:24,580 So basically, we are given two areas, let me. 25 00:01:25,850 --> 00:01:31,240 Zoom it so we are giving it to Eddie and they will contain the extraordinary in my coordinates or better 26 00:01:31,250 --> 00:01:33,830 let us rename the stadium. 27 00:01:34,100 --> 00:01:40,010 So this is extraordinary and this is why coordinate and what we need to do, we need to return them 28 00:01:40,010 --> 00:01:40,960 in a number of steps. 29 00:01:40,970 --> 00:01:45,830 So initially the count of the number of steps is zero and now the solution is very easy. 30 00:01:45,840 --> 00:01:47,830 We just need to it already. 31 00:01:47,860 --> 00:01:50,630 Eddie, let's say I am starting from one. 32 00:01:52,820 --> 00:01:56,300 And I less than X darte size. 33 00:01:58,640 --> 00:01:59,960 And I placeless. 34 00:02:02,180 --> 00:02:08,840 What we need to do, we need to take that difference off X coordinated by coordinated so and we need 35 00:02:08,840 --> 00:02:10,430 to take the maximum out of them. 36 00:02:10,729 --> 00:02:11,960 So maximum of. 37 00:02:14,530 --> 00:02:16,180 We undertake absolute defense. 38 00:02:17,970 --> 00:02:21,870 Difference affects coordinated, very coordinated, so Zulfi. 39 00:02:23,630 --> 00:02:27,860 Minus of, i.e., minus one. 40 00:02:29,220 --> 00:02:39,540 The second value is basically the absolute difference of right coordinates, so why a minus Y of a. 41 00:02:40,870 --> 00:02:41,590 Minus one. 42 00:02:43,140 --> 00:02:43,900 Simple, right? 43 00:02:44,410 --> 00:02:53,140 And what we need to do, we need to add this value to count so count plus equals to this value and that's 44 00:02:53,140 --> 00:02:53,340 it. 45 00:02:54,860 --> 00:02:56,430 So this is all that we need to do. 46 00:02:56,450 --> 00:03:00,180 And finally, we will return the minimum number of steps, which is count. 47 00:03:00,830 --> 00:03:03,850 So this is all that we need to do here, right? 48 00:03:03,890 --> 00:03:04,700 Very simple. 49 00:03:05,120 --> 00:03:06,810 Now, let's submit. 50 00:03:11,910 --> 00:03:16,770 OK, so basically our solution is to have a solution past all the test cases. 51 00:03:17,520 --> 00:03:21,120 OK, so that is how you will be able to write the code for this problem. 52 00:03:21,810 --> 00:03:23,370 So this is from this video. 53 00:03:23,520 --> 00:03:24,940 I will see you in the next one. 54 00:03:25,140 --> 00:03:25,740 Thank you.