1
00:00:01,170 --> 00:00:03,060
Hey, guys, what's up?

2
00:00:03,480 --> 00:00:06,880
So today we are going to solve one more interesting problem on Eddie.

3
00:00:07,740 --> 00:00:09,120
So the problem is very easy.

4
00:00:09,210 --> 00:00:10,320
We have to reverse the Eddie.

5
00:00:12,120 --> 00:00:13,860
Reveals the ending.

6
00:00:15,330 --> 00:00:25,320
So, for example, if my is, let's say, one, four, five and seven, so my ad, it should become

7
00:00:25,560 --> 00:00:29,460
seven, five, four and one.

8
00:00:30,390 --> 00:00:30,600
OK.

9
00:00:30,660 --> 00:00:34,080
So we have to reverse these at a in the previous problem.

10
00:00:34,200 --> 00:00:37,080
The problem was we have to print the ad in reverse order.

11
00:00:37,620 --> 00:00:39,750
So we were printing that in reverse order.

12
00:00:39,810 --> 00:00:41,190
So that was the reverse print.

13
00:00:42,270 --> 00:00:43,620
But this problem is different.

14
00:00:44,010 --> 00:00:45,960
And this problem, I have to reverse the ad.

15
00:00:46,650 --> 00:00:49,290
OK, so my new ad a little bit this.

16
00:00:51,180 --> 00:00:57,900
For example, if my hat is one, two, three, four and five.

17
00:00:58,290 --> 00:00:59,790
So my array should become.

18
00:01:01,950 --> 00:01:05,550
Five, four, three, two and one.

19
00:01:05,880 --> 00:01:08,510
So in this problem, we are not doing printing.

20
00:01:08,850 --> 00:01:10,610
We are in fact reversing the error.

21
00:01:11,610 --> 00:01:13,060
So how we can solve this problem.

22
00:01:13,090 --> 00:01:13,800
So the problem.

23
00:01:14,370 --> 00:01:16,500
So the algorithm for this problem is very easy.

24
00:01:18,090 --> 00:01:20,130
So what we have to do is suppose.

25
00:01:21,440 --> 00:01:23,030
So let us take small example.

26
00:01:23,240 --> 00:01:24,590
So suppose my ad is.

27
00:01:29,420 --> 00:01:38,350
Let's say there are six elements in the area, so two, four, five, one.

28
00:01:40,490 --> 00:01:48,760
Let's see, my elements are six and seven, so then let's say there are six elements in my area.

29
00:01:49,160 --> 00:01:51,480
So what I will do, I will take two pointers.

30
00:01:52,710 --> 00:01:54,490
So this is my start pointer.

31
00:01:55,190 --> 00:01:56,270
And this is my.

32
00:01:56,930 --> 00:01:57,640
And pointer.

33
00:01:58,530 --> 00:01:58,800
OK.

34
00:01:59,090 --> 00:02:02,270
So initially Starbase zero and is.

35
00:02:02,350 --> 00:02:03,290
And minus one.

36
00:02:03,830 --> 00:02:04,550
What I really do.

37
00:02:04,640 --> 00:02:05,350
I will swap.

38
00:02:06,290 --> 00:02:07,460
I will swab.

39
00:02:07,960 --> 00:02:08,520
Start.

40
00:02:09,440 --> 00:02:12,590
And so you will be slapped with seven.

41
00:02:12,980 --> 00:02:15,440
So here will come here.

42
00:02:15,560 --> 00:02:16,430
Seven will come.

43
00:02:17,430 --> 00:02:24,390
Then what I will do, I will increment as so as will come here and and I will come here.

44
00:02:24,450 --> 00:02:25,940
I will decrement E!

45
00:02:26,700 --> 00:02:30,150
So start bless plus and minus minus.

46
00:02:30,780 --> 00:02:32,590
Then again, I will do the swapping.

47
00:02:33,180 --> 00:02:35,130
So formally we sabata with the six.

48
00:02:36,560 --> 00:02:41,210
Then again, Start will come here and will come here.

49
00:02:41,480 --> 00:02:43,240
So five will be served with one.

50
00:02:43,910 --> 00:02:45,590
So five is so out of it.

51
00:02:45,940 --> 00:02:48,440
When then what will happen now?

52
00:02:49,550 --> 00:02:55,040
Start will come here because we are doing start plus plus and and will come here.

53
00:02:56,120 --> 00:02:57,200
So this is my end.

54
00:02:58,190 --> 00:03:01,490
Now what happened is start becomes greater then.

55
00:03:01,640 --> 00:03:04,880
And so if this is the condition where we have to do.

56
00:03:05,090 --> 00:03:05,600
Break.

57
00:03:06,950 --> 00:03:07,310
Break.

58
00:03:07,400 --> 00:03:08,230
Our problem is.

59
00:03:08,260 --> 00:03:08,690
Or what.

60
00:03:08,830 --> 00:03:11,120
And our new Addy's seven.

61
00:03:11,750 --> 00:03:12,560
Then six.

62
00:03:12,790 --> 00:03:13,580
Then one.

63
00:03:14,120 --> 00:03:14,870
Then five.

64
00:03:15,470 --> 00:03:16,130
Then four.

65
00:03:16,550 --> 00:03:17,150
And then two.

66
00:03:17,180 --> 00:03:18,350
So this is my new.

67
00:03:19,780 --> 00:03:25,420
And my previous said it was two, four, five, one, six and seven.

68
00:03:27,020 --> 00:03:28,490
So this was way out already.

69
00:03:29,630 --> 00:03:38,120
And this is and this is my updated area, so you can compare the additive also featured that.

70
00:03:39,270 --> 00:03:39,480
OK.

71
00:03:40,870 --> 00:03:42,640
So this we have to do.

72
00:03:43,790 --> 00:03:45,470
So the logic is very simple.

73
00:03:46,790 --> 00:03:49,360
So I've already made a final reverse, I not see.

74
00:03:50,330 --> 00:03:54,290
First, let us take input and then.

75
00:03:59,360 --> 00:04:00,440
That doesn't make any.

76
00:04:05,370 --> 00:04:06,310
Now we have to take.

77
00:04:07,410 --> 00:04:08,940
And we lose as input.

78
00:04:15,590 --> 00:04:16,510
Down, I

79
00:04:19,600 --> 00:04:21,670
know that reverse logic was very simple.

80
00:04:21,790 --> 00:04:22,510
Where do we have to do?

81
00:04:22,570 --> 00:04:27,700
We have to date 2.0 start is initially zero and is initially and minus one.

82
00:04:29,820 --> 00:04:40,430
So my start is initially zero and and is initially at last index.

83
00:04:41,250 --> 00:04:50,490
So how many times I have to perform swopping while my start while my start is less than or equal to.

84
00:04:50,940 --> 00:04:53,400
And so this is the condition.

85
00:04:53,610 --> 00:04:54,780
I have to swab.

86
00:04:55,620 --> 00:04:58,500
So swab it off.

87
00:04:58,590 --> 00:04:59,130
Start.

88
00:05:04,720 --> 00:05:05,270
It off.

89
00:05:05,570 --> 00:05:07,220
And so we are doing scrapping.

90
00:05:08,000 --> 00:05:17,210
So after stepping would have to do start was Implementor and and was DiClemente to start plus plus and

91
00:05:17,270 --> 00:05:18,110
minus minus.

92
00:05:19,400 --> 00:05:19,640
OK.

93
00:05:20,150 --> 00:05:25,100
So then with each line number 22, I would add it will be in reverse order.

94
00:05:25,880 --> 00:05:28,370
OK, so this is all that we have to do.

95
00:05:29,210 --> 00:05:30,230
Now let us print.

96
00:05:30,460 --> 00:05:34,510
Eddie so see you out after.

97
00:05:35,150 --> 00:05:39,020
He was so after he was.

98
00:05:39,240 --> 00:05:40,190
This is my Eddie.

99
00:05:44,450 --> 00:05:48,830
So forward and I equals zero.

100
00:05:49,310 --> 00:05:51,200
I lost him and I bless bliss.

101
00:05:53,510 --> 00:05:56,210
See out of I.

102
00:05:59,580 --> 00:06:03,570
And similarly, her dad spent before doing he was.

103
00:06:08,810 --> 00:06:09,740
So before.

104
00:06:12,790 --> 00:06:13,820
Before reverse.

105
00:06:14,790 --> 00:06:16,240
Now, let us test our program.

106
00:06:19,070 --> 00:06:22,160
Suppose there are four elements and the elements are.

107
00:06:23,280 --> 00:06:25,680
Five, one, two and three.

108
00:06:27,810 --> 00:06:29,370
OK, so there is an error.

109
00:06:30,450 --> 00:06:31,800
So what happened here is.

110
00:06:33,730 --> 00:06:34,960
Before reverse.

111
00:06:37,720 --> 00:06:42,910
So and and CNN equals zero less than an.

112
00:06:45,040 --> 00:06:46,540
Saying I before.

113
00:06:48,320 --> 00:06:50,450
I close, you know, I listed nine plus plus.

114
00:06:52,170 --> 00:06:54,050
So what happened wrong here?

115
00:06:56,580 --> 00:06:56,930
Start.

116
00:06:58,570 --> 00:07:00,190
So first to bend.

117
00:07:02,320 --> 00:07:03,580
Now let us not go well.

118
00:07:06,560 --> 00:07:08,880
There are two elementally one and two.

119
00:07:10,370 --> 00:07:11,120
Sixteen.

120
00:07:13,420 --> 00:07:14,930
So what is happening here?

121
00:07:19,070 --> 00:07:20,060
We created.

122
00:07:21,670 --> 00:07:23,320
I quote to a listing in.

123
00:07:24,600 --> 00:07:27,060
Shapelessness seen I.

124
00:07:27,180 --> 00:07:30,410
Okay, so it was a sit in I.

125
00:07:31,860 --> 00:07:34,350
And it should have been seen if I.

126
00:07:38,120 --> 00:07:39,380
OK, so this was Deanna.

127
00:07:47,300 --> 00:07:51,410
Now, there are plenty of water elements and elements are two six, one in four.

128
00:07:52,710 --> 00:07:55,820
So let's bring in one line.

129
00:08:20,500 --> 00:08:21,340
Now, let's test.

130
00:08:22,980 --> 00:08:26,490
So there are four elements and elements are two, six, one and full.

131
00:08:27,690 --> 00:08:30,520
So before reverse, this is my element.

132
00:08:30,600 --> 00:08:33,870
And after reverse, this is out of my element.

133
00:08:34,380 --> 00:08:37,380
So the defense we're doing this probably on the last order is that.

134
00:08:37,900 --> 00:08:40,230
And this problem, we are reversing the.

135
00:08:41,380 --> 00:08:41,600
OK.

136
00:08:41,700 --> 00:08:43,350
We are printing from left to right.

137
00:08:43,980 --> 00:08:45,690
We are printing from left to right.

138
00:08:45,720 --> 00:08:48,720
In the previous problem, we were printing from right to left.

139
00:08:49,590 --> 00:08:52,440
So let us tested for one more time.

140
00:08:52,850 --> 00:08:57,720
Number of elements are five and the elements are one five, nine, three and two.

141
00:08:58,800 --> 00:09:00,270
So this is before reverse.

142
00:09:00,520 --> 00:09:02,250
And this is after reelers.

143
00:09:03,040 --> 00:09:03,240
OK.

144
00:09:03,390 --> 00:09:05,160
So my code is working.

145
00:09:05,190 --> 00:09:05,940
Hundred percent.

146
00:09:06,090 --> 00:09:06,510
Correct.

147
00:09:07,320 --> 00:09:09,930
So if you have any doubt, feel free to ask.

148
00:09:10,410 --> 00:09:11,790
So this is it for this video.

149
00:09:11,880 --> 00:09:12,580
Thank you.
