1
00:00:02,530 --> 00:00:03,260
Hi, everyone.

2
00:00:03,280 --> 00:00:08,830
So today we are solving this problem, remove all ideas and duplicates, part two.

3
00:00:09,440 --> 00:00:12,210
OK, so what is the difference in this problem?

4
00:00:12,430 --> 00:00:15,370
So the difference is basically you will be given the valley of.

5
00:00:15,820 --> 00:00:18,370
So in the only problem, the last one that we have solved.

6
00:00:18,370 --> 00:00:22,510
So we have to remove two adjacent equal letters.

7
00:00:22,540 --> 00:00:26,740
OK, so we have to remove to a different equalitarian the last problem.

8
00:00:27,130 --> 00:00:31,480
But here the value of two, for example, here the value of K will be given.

9
00:00:31,960 --> 00:00:34,550
OK, so we have to remove duplicates.

10
00:00:34,820 --> 00:00:36,010
We can see.

11
00:00:36,400 --> 00:00:39,120
So this problem is also present on the code.

12
00:00:39,420 --> 00:00:43,710
So what we have to do here, so basically we have to remove duplicate.

13
00:00:43,960 --> 00:00:44,450
OK.

14
00:00:44,620 --> 00:00:47,140
And again, we will do it repeatedly.

15
00:00:48,260 --> 00:00:54,980
OK, so we will choose a decent and equal letters and then we will remove them.

16
00:00:55,230 --> 00:01:02,470
OK, so he doesn't get a decent equal letters removal.

17
00:01:02,690 --> 00:01:06,910
OK, so in the last problem that we have sold, the value of gave us two.

18
00:01:07,720 --> 00:01:14,060
OK, so in the previous column, the value of K was to retain the value of K will be given by the user.

19
00:01:14,120 --> 00:01:17,540
OK, so let's see, let's see some examples first.

20
00:01:18,080 --> 00:01:23,710
So this is important basically and string and this is the value of K, so there are no two additional

21
00:01:23,750 --> 00:01:28,130
characters, so the output will be absolutely only OK.

22
00:01:28,160 --> 00:01:32,290
So there is nothing to remove here the value of case three.

23
00:01:33,020 --> 00:01:34,790
So I will remove these three.

24
00:01:36,270 --> 00:01:37,680
I will remove these three.

25
00:01:39,090 --> 00:01:50,100
So virtually my string, so my string will become the then the then B, B, B, D, E, and so again,

26
00:01:50,100 --> 00:01:51,030
as you can see here.

27
00:01:51,060 --> 00:01:55,890
So we have this B, B, B, so we will remove it then.

28
00:01:55,920 --> 00:02:03,430
What will be our string suggesting will become D, D the A A now again we can see here.

29
00:02:03,450 --> 00:02:05,340
So this is again.

30
00:02:06,780 --> 00:02:10,380
We will remove these trees so our strength will become A&E.

31
00:02:11,070 --> 00:02:13,120
OK, so this will be our output.

32
00:02:13,980 --> 00:02:16,450
OK, so now let us consider this example.

33
00:02:16,800 --> 00:02:21,780
So the value of KS to OK, so I will remove these two.

34
00:02:23,280 --> 00:02:24,570
I will remove these two.

35
00:02:25,670 --> 00:02:26,960
I will remove these two.

36
00:02:28,260 --> 00:02:29,790
Then I will remove these two.

37
00:02:31,400 --> 00:02:32,690
Then these two.

38
00:02:33,690 --> 00:02:35,950
OK, so this hole will be removed.

39
00:02:36,630 --> 00:02:37,890
So what will be our strength?

40
00:02:38,160 --> 00:02:41,190
So this will be then we shall see.

41
00:02:41,910 --> 00:02:44,060
So B.C. then again, we shall see.

42
00:02:44,790 --> 00:02:45,900
Then we have I.

43
00:02:47,070 --> 00:02:51,320
And then again, we have and so I and it's OK.

44
00:02:51,350 --> 00:02:55,670
So now what will happen to these two and these two?

45
00:02:56,460 --> 00:02:57,450
They will be removed.

46
00:02:57,600 --> 00:03:02,670
So my answer will be B and is OK, so this will be my output string.

47
00:03:03,750 --> 00:03:06,000
This is are protesting now.

48
00:03:06,020 --> 00:03:10,050
The problem is now the question is how can we solve this question?

49
00:03:10,350 --> 00:03:15,870
OK, so in the previous question, the value of K was fixed, the value of K was to protect, the value

50
00:03:15,870 --> 00:03:17,500
of K will be variable.

51
00:03:17,880 --> 00:03:19,380
So how can we solve this question?

52
00:03:19,380 --> 00:03:23,210
So we will use the same approach that we used in the earlier problem.

53
00:03:23,230 --> 00:03:25,320
So basically we will take the help of Steck.

54
00:03:26,240 --> 00:03:33,150
OK, we will take the help of technology, let's take an example and let's say we are taking this example.

55
00:03:33,170 --> 00:03:36,800
So we will see how we can solve it with the help of a stick.

56
00:03:37,010 --> 00:03:38,510
OK, so.

57
00:03:45,140 --> 00:03:49,580
So I have the Tripoli deal, there will be see.

58
00:03:49,790 --> 00:03:51,170
OK, so I have.

59
00:03:52,430 --> 00:03:56,570
The Tripoli, they will be there, will see.

60
00:03:58,220 --> 00:04:09,910
And then be so tripathy, be the policy b, b, e, e, and the Valley of Gays, basically three.

61
00:04:10,100 --> 00:04:11,170
Let me again check.

62
00:04:11,570 --> 00:04:13,420
So this the value of K Street.

63
00:04:13,850 --> 00:04:17,269
OK, so we will take a strike now.

64
00:04:17,279 --> 00:04:19,320
This time our strike will be different.

65
00:04:19,940 --> 00:04:23,600
OK, so our strike will be a little different here.

66
00:04:24,770 --> 00:04:32,450
So in the last problem, we created a stack of characters, but here our stack will contain two things.

67
00:04:32,960 --> 00:04:35,630
OK, so the two things, I will make up it.

68
00:04:37,260 --> 00:04:39,840
And inside the beer, it will store two things.

69
00:04:39,870 --> 00:04:44,460
First is the character and secondly, the count of the character.

70
00:04:45,330 --> 00:04:47,490
OK, so let's celebrate.

71
00:04:48,390 --> 00:04:50,270
So we will trade over this drink.

72
00:04:50,550 --> 00:04:51,520
So let's see.

73
00:04:51,540 --> 00:04:58,610
So first, I am having correctly OK, so correctly we will push because this deck is empty.

74
00:04:58,620 --> 00:05:00,180
So character count this one.

75
00:05:00,240 --> 00:05:03,010
OK character and count so correctly.

76
00:05:03,030 --> 00:05:03,660
Count one.

77
00:05:05,600 --> 00:05:09,500
Now, so compare again, we are following the same approach.

78
00:05:09,530 --> 00:05:13,760
OK, so we are following the same approach that we did in the last problem.

79
00:05:15,220 --> 00:05:19,560
The only differences we are like we are maintaining a count variable also.

80
00:05:19,630 --> 00:05:25,230
OK, so compare the current parliament with the top of the stack so evenly they are different.

81
00:05:25,450 --> 00:05:26,640
So I will push it.

82
00:05:27,160 --> 00:05:29,410
So push the count this one.

83
00:05:31,190 --> 00:05:34,610
OK, now, so compare it with E!

84
00:05:35,450 --> 00:05:42,230
OK, so they are saying, so what I will do, I will increase the count, so I will make the count to.

85
00:05:43,830 --> 00:05:50,250
And then after making the count to I will check with the T. So the count is two and check the value

86
00:05:50,250 --> 00:05:53,010
of street so I don't have to do anything.

87
00:05:53,080 --> 00:05:53,430
OK.

88
00:05:54,370 --> 00:06:01,630
Now, again, to compare it with me now, I will make the count three, so I will make this count three

89
00:06:01,870 --> 00:06:06,800
now see the value of Kastari and our topmost element as count three.

90
00:06:06,820 --> 00:06:07,600
So what I will do.

91
00:06:07,600 --> 00:06:08,280
I will pop.

92
00:06:09,370 --> 00:06:10,250
I will pop.

93
00:06:10,480 --> 00:06:12,220
So we are following the same rules.

94
00:06:12,370 --> 00:06:13,810
So the rules are very simple.

95
00:06:14,050 --> 00:06:16,330
So rule number one, if the stack is empty.

96
00:06:16,340 --> 00:06:17,080
So if.

97
00:06:18,310 --> 00:06:19,510
Stack empty.

98
00:06:20,990 --> 00:06:21,740
Then Bush.

99
00:06:22,720 --> 00:06:24,740
So this was our Alirio also.

100
00:06:25,000 --> 00:06:28,690
Now the second rule was so compare the current element.

101
00:06:28,720 --> 00:06:35,050
So this is compare it to the current elements of the current element is not close to the top most element.

102
00:06:35,410 --> 00:06:38,470
So basically stack up then.

103
00:06:38,470 --> 00:06:40,160
Also, we are pushing the element.

104
00:06:40,630 --> 00:06:43,820
Now, the third is so now the elements are equal.

105
00:06:43,840 --> 00:06:45,160
Basically, this is the condition.

106
00:06:45,160 --> 00:06:48,970
The current element is it goes to the topmost element of the stack.

107
00:06:50,220 --> 00:06:56,040
Stacked on top, so stacked on top is going to things, so I want to compare the character, so I want

108
00:06:56,040 --> 00:06:56,640
the character.

109
00:06:56,770 --> 00:06:58,740
OK, so this is the coalition.

110
00:06:58,750 --> 00:07:01,440
So if this is the coalition, would I have to do so?

111
00:07:01,440 --> 00:07:02,490
I will do what I will do.

112
00:07:02,490 --> 00:07:03,830
I will increase the count.

113
00:07:03,840 --> 00:07:05,410
So increase the count.

114
00:07:06,240 --> 00:07:08,540
So basically I can take count plus plus.

115
00:07:09,510 --> 00:07:10,410
So we are increasing.

116
00:07:10,420 --> 00:07:14,010
So this was one that I made it to and then I made it three.

117
00:07:14,350 --> 00:07:17,040
OK, so we will do count plus plus.

118
00:07:17,250 --> 00:07:24,300
And if the count becomes equal to the given value which is key then pop.

119
00:07:25,390 --> 00:07:26,920
OK then Bob.

120
00:07:28,260 --> 00:07:29,940
So this is the only difference here.

121
00:07:30,030 --> 00:07:32,370
OK, so this is the significance of count.

122
00:07:32,850 --> 00:07:38,430
If the count becomes key then pop now the so yes.

123
00:07:38,430 --> 00:07:39,280
These present.

124
00:07:39,300 --> 00:07:40,110
So what I will do.

125
00:07:40,110 --> 00:07:40,510
I will.

126
00:07:40,530 --> 00:07:41,500
So this is not here.

127
00:07:41,520 --> 00:07:46,620
OK, so this is the topmost element of the stack right now to the custody.

128
00:07:46,630 --> 00:07:51,950
So I will make the count to now compare the count two with three so they are not equal.

129
00:07:51,960 --> 00:07:52,860
I will move ahead.

130
00:07:53,340 --> 00:08:01,130
So be so I will push B so I am pushing B, so this is B and the count is one.

131
00:08:01,920 --> 00:08:05,640
OK, then again B so I will make the count to.

132
00:08:06,660 --> 00:08:13,230
Then see, so basically, see, this is see and the counties won again.

133
00:08:13,590 --> 00:08:16,500
So make the count two again.

134
00:08:16,860 --> 00:08:18,180
So make the count three.

135
00:08:19,340 --> 00:08:23,480
As soon as the count becomes close to what I will do, I will pop.

136
00:08:23,510 --> 00:08:30,490
OK, so I will pop now be to compare it to be at the top.

137
00:08:30,530 --> 00:08:33,260
I am having the same element, so I will make the country.

138
00:08:33,710 --> 00:08:37,059
So as soon as the count become close to me, I will pop.

139
00:08:37,090 --> 00:08:44,930
So Bob, now currently my stack is only having one element, which is the and its count is to.

140
00:08:45,630 --> 00:08:48,870
OK, so again B so what will you do.

141
00:08:48,920 --> 00:08:55,330
So the current element is it goes to the topmost element to make the count three and three close together.

142
00:08:55,340 --> 00:08:56,630
So I will pop the element.

143
00:08:56,660 --> 00:08:58,640
Now my stomach is empty at this point.

144
00:08:58,880 --> 00:09:06,800
OK, so I have e so my steak is empty so I have a small E and the count is one.

145
00:09:06,980 --> 00:09:13,430
OK, again, so I have a and the current element is it goes to the topmost element, so I will increase

146
00:09:13,430 --> 00:09:19,130
the count so and so basically this is my steak and then I will reach the end of the string.

147
00:09:19,340 --> 00:09:26,730
So when I reach the end of the string this is my stack e and its count is to OK.

148
00:09:26,750 --> 00:09:28,700
So how will I know my answer.

149
00:09:29,090 --> 00:09:30,590
So basically this is my answer.

150
00:09:30,620 --> 00:09:32,390
What I will do, I will pop the element.

151
00:09:33,050 --> 00:09:35,750
So basically for constructing the answer, pop the element.

152
00:09:35,750 --> 00:09:42,980
And it's this to so that since the count is two, I will write it two times and then our standard approach,

153
00:09:42,990 --> 00:09:43,600
what will do?

154
00:09:43,610 --> 00:09:45,610
We will reverse our answer.

155
00:09:45,860 --> 00:09:46,760
So we will reverse.

156
00:09:46,790 --> 00:09:52,870
So in this case, after reversing, we are getting the same answer and say, OK, but we have to reverse.

157
00:09:53,090 --> 00:09:54,770
So I have to reverse.

158
00:09:54,800 --> 00:09:55,160
OK.

159
00:09:56,460 --> 00:10:00,720
Now, after everything in this case, we are getting the same answer, but the answer may have been

160
00:10:00,720 --> 00:10:01,200
different.

161
00:10:01,230 --> 00:10:04,410
OK, if you won't let us dry on one more example.

162
00:10:04,920 --> 00:10:07,530
OK, so let us take one more example.

163
00:10:08,770 --> 00:10:18,220
OK, so I'm taking example on my own, so let us say this is A, then B, then B and let's say I have

164
00:10:18,240 --> 00:10:29,140
a A A again, I have led to B, then C, C, C, and then E, and let's say I have D here and then the.

165
00:10:29,170 --> 00:10:31,210
OK, so let us consider this example.

166
00:10:31,420 --> 00:10:33,460
OK, let us consider this one example.

167
00:10:34,500 --> 00:10:37,440
And let's say the valley of caves, basically three.

168
00:10:38,310 --> 00:10:40,710
OK, so let's see what will happen.

169
00:10:41,810 --> 00:10:43,650
Let's put you here also.

170
00:10:43,670 --> 00:10:44,030
OK?

171
00:10:44,720 --> 00:10:46,160
And the value of K Street.

172
00:10:46,430 --> 00:10:48,440
OK, so let us consider a stack.

173
00:10:49,130 --> 00:10:52,580
Stack will contain two things counting character.

174
00:10:52,700 --> 00:10:55,280
OK, so I will have a count.

175
00:10:55,820 --> 00:11:00,970
I will have I will have character and its corresponding count.

176
00:11:01,130 --> 00:11:01,490
OK.

177
00:11:02,810 --> 00:11:11,870
So what I will do so I will create a stack of beer and beer is basically a glass which has two properties,

178
00:11:11,870 --> 00:11:13,130
character and count.

179
00:11:13,380 --> 00:11:14,420
OK, so let's see.

180
00:11:14,750 --> 00:11:15,460
This is Dee.

181
00:11:15,470 --> 00:11:24,760
So the count this one again, B, make the count to compare two with three.

182
00:11:24,800 --> 00:11:25,470
They are different.

183
00:11:25,540 --> 00:11:27,260
OK, so E.

184
00:11:28,530 --> 00:11:33,630
So Bush counters once again, eh, so make the count to.

185
00:11:35,320 --> 00:11:42,880
So I have been so push be counted as one again, be so we will make the count to.

186
00:11:44,600 --> 00:11:45,400
Then push.

187
00:11:45,800 --> 00:11:53,900
So I have the count is one again, a make the count to again, a make the count three.

188
00:11:54,530 --> 00:11:58,650
OK, so at this point my count is three and three equals.

189
00:11:59,720 --> 00:12:02,050
So what I'm going to do here is I will pop.

190
00:12:02,600 --> 00:12:03,560
So Pop.

191
00:12:05,410 --> 00:12:09,430
OK, so now let's move forward so I have B.

192
00:12:10,560 --> 00:12:18,690
IFB, so what I will do, I will make the count three and three equals three equals K, so what I will

193
00:12:18,690 --> 00:12:19,560
do, I will pop.

194
00:12:22,010 --> 00:12:30,590
OK, so let's move forward, so I have see, so I have this see count is one again, C so count becomes

195
00:12:30,590 --> 00:12:33,610
two again, C, so count becomes three.

196
00:12:34,310 --> 00:12:37,880
And as soon as the count becomes equals to what I will do, I will pop.

197
00:12:39,930 --> 00:12:41,350
OK, now let's move ahead.

198
00:12:41,370 --> 00:12:42,090
So I have.

199
00:12:42,780 --> 00:12:46,730
So this is a so I will make the count three and then I will pop.

200
00:12:48,630 --> 00:12:56,430
Now that's more I have E so I have E count is one, then I have E, so count becomes two.

201
00:12:57,520 --> 00:12:59,920
And then I will reach the end of the string.

202
00:13:00,080 --> 00:13:01,540
OK, so what is my answer?

203
00:13:01,840 --> 00:13:08,590
First, I will pop this element E and I will write two times E, so two times E, then I will pop this

204
00:13:08,590 --> 00:13:09,010
element.

205
00:13:09,010 --> 00:13:12,700
I will write two times the OK and then I will reverse.

206
00:13:14,230 --> 00:13:19,360
So after reversing, my answer will be Dee Dee Dee, and so this is the correct answer.

207
00:13:19,930 --> 00:13:24,280
OK, so you can also see from here, first of all, what will happen.

208
00:13:24,290 --> 00:13:29,200
So I will remove these three and I will remove these three.

209
00:13:29,850 --> 00:13:32,870
OK, so removing these three and removing these three.

210
00:13:33,340 --> 00:13:34,330
So what will happen?

211
00:13:34,610 --> 00:13:36,040
I will have B.

212
00:13:37,030 --> 00:13:38,020
And this be.

213
00:13:40,090 --> 00:13:43,210
Then it will be removed, then what will happen?

214
00:13:43,240 --> 00:13:45,850
So I will have this to and this.

215
00:13:46,510 --> 00:13:52,090
So then they will be removed and finally I will have died and this last two years.

216
00:13:52,720 --> 00:13:56,140
So this will be our answer and our answer is basically right.

217
00:13:57,050 --> 00:13:59,380
OK, so what will be our approach?

218
00:13:59,410 --> 00:14:07,800
So first of all, I will make a stack of beer and what this beer is basically I think it will be a glass,

219
00:14:08,290 --> 00:14:13,270
OK, and it's the type will be it will be collected in an integer.

220
00:14:13,270 --> 00:14:17,940
So character basically let's call it first and integer, let's call it second.

221
00:14:18,190 --> 00:14:22,690
OK, so character, you're going to distort the meaning of character and integer here.

222
00:14:22,700 --> 00:14:25,040
So your second means basically the count.

223
00:14:25,880 --> 00:14:28,660
OK, so I'm naming it first and second.

224
00:14:29,740 --> 00:14:31,970
OK, so I hope you understand this question.

225
00:14:32,920 --> 00:14:36,010
OK, so now let's write the code, ok.

226
00:14:40,750 --> 00:14:42,160
So what I'm doing here is.

227
00:14:43,390 --> 00:14:44,680
I am copping this cold.

228
00:14:46,740 --> 00:14:51,360
I'll get admitted in the last session, so let us copy this could.

229
00:14:54,130 --> 00:14:58,900
So what do we want, first of all, we need a glass, glass of beer.

230
00:14:59,980 --> 00:15:01,290
For creating this tag.

231
00:15:02,060 --> 00:15:05,720
OK, so I need to do the members first and second.

232
00:15:06,100 --> 00:15:07,820
So, first of all, stole the character.

233
00:15:08,650 --> 00:15:15,210
OK, so first we stole the character and second will store the count.

234
00:15:15,350 --> 00:15:15,670
OK.

235
00:15:16,990 --> 00:15:18,160
So this first.

236
00:15:21,680 --> 00:15:23,420
This will store the character.

237
00:15:25,400 --> 00:15:26,480
And the second.

238
00:15:28,970 --> 00:15:31,350
It will store the count, OK?

239
00:15:31,400 --> 00:15:32,500
It will store the count.

240
00:15:34,960 --> 00:15:36,190
So what do I want?

241
00:15:37,660 --> 00:15:39,730
So first of all, I want to create Aztek.

242
00:15:40,850 --> 00:15:42,440
I will create a stack of beer.

243
00:15:42,530 --> 00:15:44,540
OK, so let's say the name is is.

244
00:15:45,590 --> 00:15:46,970
Then this is the old gold.

245
00:15:47,050 --> 00:15:54,110
So, again, we have to ideato the eddy over the string, if the string is the stake is empty, I am

246
00:15:54,110 --> 00:15:59,810
pushing and if they are different to the current element drop element, they are different then I'm

247
00:15:59,820 --> 00:16:03,290
again pushing, but I have to push up it.

248
00:16:03,300 --> 00:16:05,620
OK, so I have to push up bit.

249
00:16:06,640 --> 00:16:08,500
So let us create a prayer first.

250
00:16:08,530 --> 00:16:12,240
So I am creating an object of the class.

251
00:16:12,280 --> 00:16:14,920
OK, so I am creating an object to BRP.

252
00:16:15,970 --> 00:16:22,240
And I have to give its value, so the value, the character is of I and its count this one.

253
00:16:22,300 --> 00:16:26,060
OK, so for this line to work, I have to create deconstruct.

254
00:16:26,060 --> 00:16:28,990
But OK, so I have to create the constructor.

255
00:16:29,920 --> 00:16:33,970
So let's create the constructor so I have this constructor beard.

256
00:16:35,280 --> 00:16:36,540
It will take two things.

257
00:16:37,880 --> 00:16:39,770
Character and count.

258
00:16:39,920 --> 00:16:44,870
OK, so first and second, so first exclusive.

259
00:16:46,900 --> 00:16:48,220
And technically, yes.

260
00:16:49,400 --> 00:16:52,110
OK, so now I have a debate.

261
00:16:52,460 --> 00:16:55,650
So after the debate, I am pushing peer inside the stack.

262
00:16:56,000 --> 00:16:56,450
OK.

263
00:16:56,810 --> 00:16:58,460
I am pushing the object to be.

264
00:17:00,060 --> 00:17:05,000
OK, so now let us come to the part now in the last part, I cannot directly pop.

265
00:17:05,069 --> 00:17:06,170
OK, so this is wrong.

266
00:17:06,180 --> 00:17:07,220
I cannot pop.

267
00:17:07,470 --> 00:17:11,700
So as we discussed what we are doing, so first we are increasing the count.

268
00:17:11,760 --> 00:17:15,510
OK, so first, what we are doing, we are in the correct policy.

269
00:17:15,930 --> 00:17:21,210
If the correct policy, we are increasing the count and then we are checking the count with the key.

270
00:17:21,960 --> 00:17:26,060
OK, so first increase count and then check the count with key.

271
00:17:27,410 --> 00:17:35,330
OK, so at this point, elements are saying, OK, so basically, Alphie, the current element is basically

272
00:17:35,330 --> 00:17:37,120
close to the top element of the stick.

273
00:17:38,470 --> 00:17:44,740
OK, so current element, top elements of what I have to do first, I have to increase the count of

274
00:17:44,740 --> 00:17:47,490
the topmost element so as not top.

275
00:17:48,100 --> 00:17:50,660
So after writing a start up, what will I get?

276
00:17:50,950 --> 00:17:54,310
I will get a paper now to access the character.

277
00:17:54,610 --> 00:17:55,570
To access the account.

278
00:17:55,570 --> 00:17:56,770
I have to write second.

279
00:17:56,800 --> 00:17:58,840
OK, so I start topknot.

280
00:17:59,920 --> 00:18:00,520
Second.

281
00:18:01,490 --> 00:18:08,510
Now, I would have to write placeless, so I've increased the count, so what is the count count as

282
00:18:08,510 --> 00:18:10,150
basically a start?

283
00:18:12,230 --> 00:18:14,000
Stop that second now.

284
00:18:14,010 --> 00:18:15,800
What I have to do, I have to check the count.

285
00:18:15,810 --> 00:18:17,060
So if the count.

286
00:18:18,250 --> 00:18:21,800
Becomes close to what I have to do, I have to pop.

287
00:18:21,860 --> 00:18:23,230
OK, so Astarte Pop.

288
00:18:24,430 --> 00:18:25,310
So very simple.

289
00:18:26,000 --> 00:18:32,570
OK, so now let us now hear what we are doing, so we are making our answer.

290
00:18:32,620 --> 00:18:35,510
OK, so what we are doing while Steg is not empty.

291
00:18:35,860 --> 00:18:44,140
So first of all, it will not be as top I as door top is basically what Azer Top is basically a pair.

292
00:18:44,140 --> 00:18:48,010
It will return me a pair object and I want the character for character.

293
00:18:48,010 --> 00:18:49,090
I have to write first.

294
00:18:49,120 --> 00:18:52,660
OK, you can see here for playing the character, I have to write first.

295
00:18:53,020 --> 00:19:00,830
So basically this is not right because as you can see here, as you can see here, so it was like D

296
00:19:00,880 --> 00:19:04,190
and do so since it was two there.

297
00:19:04,190 --> 00:19:10,660
And I have to write, I have to copy the two times, OK, I have to copy the two times so I have to

298
00:19:10,660 --> 00:19:11,920
take care of count also.

299
00:19:12,980 --> 00:19:15,320
So completely to times what I have to do.

300
00:19:15,350 --> 00:19:17,510
So, first of all, we will find out the count.

301
00:19:18,380 --> 00:19:21,770
OK, so how many times we need that character?

302
00:19:22,190 --> 00:19:28,340
So for finding out the top, for finding out the count, we need the second and.

303
00:19:29,620 --> 00:19:31,180
Well, count to minus minus.

304
00:19:32,900 --> 00:19:35,320
How many times we need that element?

305
00:19:35,330 --> 00:19:35,660
OK.

306
00:19:38,780 --> 00:19:44,810
So after copping the element count times, I will pop that element and then I am reversing and then

307
00:19:44,810 --> 00:19:49,460
I'm returning my answer, OK, so I hope everything is fine.

308
00:19:50,000 --> 00:19:53,090
Now, let's try to run our record and then we will try to it.

309
00:19:57,250 --> 00:19:58,150
OK, so.

310
00:20:02,530 --> 00:20:04,440
OK, so this indexer, OK?

311
00:20:13,860 --> 00:20:18,180
OK, so here we have to as dot dot basically is returning me.

312
00:20:19,370 --> 00:20:21,830
Appear object, and I want the correct.

313
00:20:22,050 --> 00:20:24,290
So for playing the character, I have to write first.

314
00:20:27,330 --> 00:20:29,430
OK, so now let's run.

315
00:20:36,340 --> 00:20:37,570
Now, let's try to sum it.

316
00:20:41,220 --> 00:20:43,480
OK, so our court is working fine.

317
00:20:43,500 --> 00:20:47,430
OK, so yes, our court is working fine.

318
00:20:50,080 --> 00:20:51,690
Now, let's have a call one more time.

319
00:20:53,080 --> 00:20:59,050
OK, so what we are doing here, so first of all, I am creating a stack of beer and what is beer?

320
00:20:59,470 --> 00:21:01,480
Superior's containing two things.

321
00:21:01,960 --> 00:21:09,400
So first one is restoring the character in the variable first, and it is the count in the variable

322
00:21:09,400 --> 00:21:09,880
second.

323
00:21:10,750 --> 00:21:11,090
OK.

324
00:21:11,110 --> 00:21:12,740
So I'm creating a stack of beer.

325
00:21:13,030 --> 00:21:16,630
The name is then I'm meditating over the string.

326
00:21:16,840 --> 00:21:20,720
So if the steak is empty, then as discussed, we have to push up beer.

327
00:21:20,800 --> 00:21:22,470
OK, so what staggers off beer.

328
00:21:22,480 --> 00:21:25,380
So I have to push up here and start up.

329
00:21:25,630 --> 00:21:30,760
So basically what is a up as there basically will return me a beer object.

330
00:21:32,100 --> 00:21:33,960
It will return me a beer object.

331
00:21:34,110 --> 00:21:38,190
Now I want to access the first element, I want to access its character.

332
00:21:38,220 --> 00:21:41,260
OK, I want to kiss the characters, so I have to write that first.

333
00:21:41,960 --> 00:21:44,610
OK, then here what I am creating.

334
00:21:44,610 --> 00:21:45,990
I am calling the constructor.

335
00:21:46,290 --> 00:21:46,660
OK.

336
00:21:46,680 --> 00:21:49,680
So for calling the constructor, I need to pass two variables.

337
00:21:50,190 --> 00:21:55,890
So I'm calling the constructor here and the character is basically of I and the count is basically one

338
00:21:56,070 --> 00:21:57,680
and then I am pushing the character.

339
00:21:58,020 --> 00:22:03,720
So in the ls part as discussed first, what we have to do, we have to do count plus plus we have to

340
00:22:03,720 --> 00:22:04,640
increase the count.

341
00:22:04,800 --> 00:22:12,150
So I am doing count plus also as the top is basically will return me the object and with the help of

342
00:22:12,150 --> 00:22:14,150
dart second I will get the count.

343
00:22:14,400 --> 00:22:16,260
So I'm doing that second plus plus.

344
00:22:16,860 --> 00:22:22,170
So I'm starting the counting, the variable count and then I am checking this condition and the count

345
00:22:22,170 --> 00:22:22,770
becomes key.

346
00:22:22,860 --> 00:22:24,250
I am popping over element.

347
00:22:24,310 --> 00:22:29,220
OK, and this is like the old code for getting the answer.

348
00:22:29,250 --> 00:22:35,820
So while the stack is not empty, first of all, like we see in the previous examples of these appearing

349
00:22:35,820 --> 00:22:36,390
two times.

350
00:22:36,750 --> 00:22:38,500
So I have to copy these two times.

351
00:22:38,580 --> 00:22:40,840
So that's why I will count minus minus.

352
00:22:41,520 --> 00:22:45,270
So these many number of times, the first element will be copied.

353
00:22:45,660 --> 00:22:50,610
And then after copying the element, we are popping the element, then reversing the element, reversing

354
00:22:50,610 --> 00:22:52,950
the string, and then we are returning our answer.

355
00:22:53,160 --> 00:22:55,310
OK, so wild card, minus minus.

356
00:22:55,770 --> 00:22:59,260
So if you are getting confused, what is the meaning of wild card minus minus.

357
00:22:59,260 --> 00:23:00,780
So it is basically like this.

358
00:23:00,780 --> 00:23:02,310
Well count this guerdon zero.

359
00:23:03,930 --> 00:23:07,250
Some work and then I'm going doing count minus minus.

360
00:23:07,290 --> 00:23:10,010
OK, so this is short way too, right?

361
00:23:10,020 --> 00:23:10,300
OK.

362
00:23:10,320 --> 00:23:11,940
So this is short way to this thing.

363
00:23:13,510 --> 00:23:17,470
Welcome, discordance zero, do this thing OK, so shortly.

364
00:23:17,510 --> 00:23:18,760
Welcome to minus minus.

365
00:23:18,810 --> 00:23:19,120
OK.

366
00:23:21,660 --> 00:23:30,540
Now, one thing that I want to tell you here is so here what we are doing, so I'm creating a class.

367
00:23:31,710 --> 00:23:33,760
Be it OK?

368
00:23:33,780 --> 00:23:37,340
So I'm getting a glass where it has two properties, first and second.

369
00:23:37,800 --> 00:23:43,830
So in this case it was in our case it was character first and can be just second.

370
00:23:45,790 --> 00:23:53,290
OK, so in C++, we have a beer glass and we have inbuilt built class.

371
00:23:55,140 --> 00:23:59,860
OK, we have built beer glass and the structure of inbuilt beer glass is very simple.

372
00:23:59,870 --> 00:24:02,410
So it is glass beer.

373
00:24:05,110 --> 00:24:11,440
Again, it will make public so it is like templated first.

374
00:24:12,760 --> 00:24:14,170
And Bamblett.

375
00:24:15,400 --> 00:24:23,200
Second, and it has all other functions that we will see in very short time, so template means basically

376
00:24:23,200 --> 00:24:29,340
we can write in budget here, we can write character here, we can write flawed here, we can write

377
00:24:29,350 --> 00:24:32,230
string here, OK, so we can write anything.

378
00:24:32,230 --> 00:24:38,230
We can write that here, we can write map here, we can write Gule here.

379
00:24:38,230 --> 00:24:39,940
We can write a stack here.

380
00:24:39,970 --> 00:24:41,440
Basically we can write anything.

381
00:24:41,470 --> 00:24:47,590
OK, so the inbuilt A which is already implemented in C++, that is very, very powerful.

382
00:24:47,650 --> 00:24:52,000
OK, so we do not have to create the glass ourselves.

383
00:24:52,120 --> 00:24:57,820
OK, so we have this in class and now we will now we will see how to use that better class.

384
00:24:58,540 --> 00:25:00,520
OK, so for creating the steg.

385
00:25:01,710 --> 00:25:05,250
What I will write, I will write back then, be it.

386
00:25:06,160 --> 00:25:08,440
Then what I will do, so I need two things.

387
00:25:08,470 --> 00:25:15,100
OK, so first and second and first will be character comma.

388
00:25:15,110 --> 00:25:20,420
Second will be in danger because print count, so second will be integer.

389
00:25:20,980 --> 00:25:24,250
So this is the syntax opening record and closing record for beer.

390
00:25:24,460 --> 00:25:28,060
And now this is opening bracket and this is the closing bracket for beer.

391
00:25:28,060 --> 00:25:34,330
And now the name of this deck, which is as so if you will write this now, it is wrong.

392
00:25:34,630 --> 00:25:34,850
Why?

393
00:25:34,870 --> 00:25:36,310
It is wrong because see.

394
00:25:37,920 --> 00:25:39,540
Have you read this text before?

395
00:25:39,570 --> 00:25:44,470
Yes, it is very similar to see in Goodin Goodin so the simplest reason to get confused here.

396
00:25:44,490 --> 00:25:49,100
So what I have to do so I will write integer greater than this symbol.

397
00:25:49,110 --> 00:25:55,170
So the symbolism of then I have to leave space, I will leave space, then I will right this second

398
00:25:55,170 --> 00:25:55,410
one.

399
00:25:55,880 --> 00:26:01,350
OK, so that C++ do not get confused between this operator, this radio operator.

400
00:26:01,530 --> 00:26:04,050
OK, so I will leave a space.

401
00:26:09,170 --> 00:26:09,980
OK, so.

402
00:26:11,770 --> 00:26:16,510
Let's come out this part now, I will use and build a better class.

403
00:26:16,570 --> 00:26:19,330
OK, so we are using and built better class.

404
00:26:20,850 --> 00:26:27,600
We have a class in C++ and you should know how to use that class, so that's why I am covering that

405
00:26:27,600 --> 00:26:28,240
topic here.

406
00:26:28,380 --> 00:26:32,570
OK, so in class, let's see how to use it.

407
00:26:35,350 --> 00:26:38,620
OK, so what I'm doing here, let's remove it from here.

408
00:26:40,980 --> 00:26:42,620
Let's come out, everything OK?

409
00:26:50,230 --> 00:26:51,940
Now, let's see in world class.

410
00:26:56,740 --> 00:26:59,350
So it is very easy to use.

411
00:27:03,920 --> 00:27:05,450
So let's first copy the code.

412
00:27:27,390 --> 00:27:29,580
OK, so now we're creating a stick.

413
00:27:29,610 --> 00:27:34,680
What I will write, I will write, I need a beer, which is already implemented in C++.

414
00:27:34,980 --> 00:27:37,230
Now, the pair will have two things first and second.

415
00:27:37,240 --> 00:27:38,890
So first, I want character.

416
00:27:39,190 --> 00:27:40,910
Second, I want count.

417
00:27:41,200 --> 00:27:45,360
OK, so and then I will leave a space and then this.

418
00:27:45,390 --> 00:27:46,770
OK, so this is the syntax.

419
00:27:47,790 --> 00:27:48,130
OK.

420
00:27:48,150 --> 00:27:50,400
So you know why I would leave the space here?

421
00:27:50,400 --> 00:27:50,900
Because.

422
00:27:51,310 --> 00:27:53,440
Because you know it is like this only.

423
00:27:53,460 --> 00:27:53,680
OK.

424
00:27:53,700 --> 00:27:57,690
So I have to leave space so that C++ does not get confused again.

425
00:27:58,050 --> 00:28:02,730
So I am I reading stack empty the top dog first.

426
00:28:02,940 --> 00:28:05,460
So that first is already there in class.

427
00:28:05,520 --> 00:28:05,910
OK.

428
00:28:06,240 --> 00:28:10,330
It is first and second they are fixed you can see here.

429
00:28:11,340 --> 00:28:15,390
So these names are fixed first and second, these names are fixed.

430
00:28:15,390 --> 00:28:16,820
You cannot change these names.

431
00:28:17,190 --> 00:28:20,610
OK, you only can decide that type.

432
00:28:20,620 --> 00:28:26,160
OK, whether it will be integer character, flawed string vector map keywords stack or anything else

433
00:28:26,160 --> 00:28:26,820
or priority.

434
00:28:26,840 --> 00:28:28,980
Q OK, you cannot change the names.

435
00:28:28,980 --> 00:28:31,500
The names are fixed of inbuilt class.

436
00:28:31,840 --> 00:28:32,250
OK.

437
00:28:33,280 --> 00:28:35,440
So the names are fixed, so we cannot change them.

438
00:28:35,920 --> 00:28:38,530
So what I have to do, I have to push up here.

439
00:28:38,740 --> 00:28:40,600
OK, so we're pushing up here.

440
00:28:41,790 --> 00:28:46,050
So let us come and this part, OK, so let's delete this part.

441
00:28:47,060 --> 00:28:48,410
So I have to push up here.

442
00:28:50,540 --> 00:28:55,980
So we're pushing up here, but we have to do we have to make first so from making a beer, what can

443
00:28:56,000 --> 00:28:56,240
do?

444
00:28:56,450 --> 00:28:57,320
So I have a function.

445
00:28:57,330 --> 00:28:57,920
Make beer.

446
00:28:59,340 --> 00:29:03,900
So this is a function, make beer and I will give two things.

447
00:29:04,110 --> 00:29:05,630
First, one should be character.

448
00:29:05,910 --> 00:29:07,340
Second one should be in beta.

449
00:29:08,220 --> 00:29:11,520
So first one should be collectivities of a second.

450
00:29:11,520 --> 00:29:13,140
One should be in BIJA, which is one.

451
00:29:14,580 --> 00:29:15,750
OK, very simple.

452
00:29:17,010 --> 00:29:19,050
Now everything else will remain same.

453
00:29:20,320 --> 00:29:22,030
OK, so yes.

454
00:29:23,890 --> 00:29:25,570
Yes, everything else will remain, Tim.

455
00:29:27,000 --> 00:29:28,110
Now, let's do another good.

456
00:29:32,790 --> 00:29:34,140
See Sea of Cortez working.

457
00:29:35,270 --> 00:29:37,830
And we do not have to implement any on our own.

458
00:29:37,910 --> 00:29:38,250
OK?

459
00:29:38,270 --> 00:29:43,670
We do not need to create Castlerock, but also so see, we are getting eight milliseconds.

460
00:29:45,380 --> 00:29:47,050
Sow discord is faster.

461
00:29:47,090 --> 00:29:53,460
OK, so we are not creating this because we do not need to write this code ourself.

462
00:29:53,480 --> 00:29:53,760
OK.

463
00:29:53,780 --> 00:29:59,750
So these variables and this construct, there is no need to write this, just simply use the inbuilt

464
00:29:59,760 --> 00:30:00,390
berglas.

465
00:30:01,160 --> 00:30:03,230
OK, so we have this in class.

466
00:30:03,530 --> 00:30:05,600
You have to give two things first and second.

467
00:30:05,610 --> 00:30:06,670
First one is correct.

468
00:30:06,700 --> 00:30:14,450
The second one is of type integer, OK, for making the variable function, make beer and I'm giving

469
00:30:14,450 --> 00:30:16,070
the first value should be character.

470
00:30:16,220 --> 00:30:17,900
Second value should be integer.

471
00:30:18,820 --> 00:30:21,250
OK, and everything else is seem.

472
00:30:22,320 --> 00:30:26,610
So I think there is one more way to create a peer.

473
00:30:27,670 --> 00:30:29,170
There is one more way to create a.

474
00:30:29,690 --> 00:30:37,360
I I'm trying to remember the in so Burpee is basically I think if I.

475
00:30:39,370 --> 00:30:42,310
Come on, I'm just trying it, I don't remember.

476
00:30:50,120 --> 00:30:52,520
So Astarte, Bush.

477
00:30:53,580 --> 00:30:53,910
B.

478
00:30:56,400 --> 00:30:57,180
So let's see.

479
00:31:01,720 --> 00:31:08,050
OK, so this is working OK, so we can also create a like this BRP and we can initialize in the same

480
00:31:08,050 --> 00:31:11,750
line instead of using the McPaper function, we can write this one.

481
00:31:12,220 --> 00:31:15,550
So if we can write this, I think we can also write like this.

482
00:31:17,570 --> 00:31:18,290
Beilby.

483
00:31:20,490 --> 00:31:21,540
So a.

484
00:31:22,850 --> 00:31:23,480
Come on.

485
00:31:28,720 --> 00:31:33,900
OK, so we can write like this also so we know there are three ways to make beer.

486
00:31:34,380 --> 00:31:38,250
OK, so at this point we know there are three ways to make beer.

487
00:31:38,560 --> 00:31:39,730
So the first rays.

488
00:31:41,460 --> 00:31:46,200
BP is basically you give the values first value and the second value.

489
00:31:47,250 --> 00:31:49,470
Now, the second option is basically BRP.

490
00:31:50,450 --> 00:31:57,060
You give the first value, you give the second value, and the third option is basically using a make

491
00:31:57,080 --> 00:31:57,800
beer function.

492
00:31:59,430 --> 00:32:02,230
Make their first value, second value.

493
00:32:02,580 --> 00:32:10,860
OK, so beer can be of any type, for example, you can create beer like beer of characters, khama

494
00:32:11,220 --> 00:32:12,360
beer inside the beer.

495
00:32:12,660 --> 00:32:20,940
So beer of, let's say, integer combine integer then FirstRand this bracket then I have to close this

496
00:32:20,940 --> 00:32:23,170
bracket but A should be there.

497
00:32:23,940 --> 00:32:28,800
OK as we should be there otherwise it will get so this will get confused.

498
00:32:29,190 --> 00:32:32,760
So zipless will get confused with with this record this operator.

499
00:32:33,000 --> 00:32:34,140
So USPI should be there.

500
00:32:34,140 --> 00:32:36,810
And then the name for example to Putu.

501
00:32:37,770 --> 00:32:45,060
OK, so Bill can be off anytime, so be of, let's see, first values, vector and vector of.

502
00:32:46,210 --> 00:32:54,730
In Egypt now, the second value is basically, let's call it a map, so a map and inside the map, let's

503
00:32:54,730 --> 00:33:02,100
see, I have I inside the map, I have beer and inside the beer, let's say I have Digicom integer.

504
00:33:02,890 --> 00:33:04,810
So first the map will finish.

505
00:33:04,840 --> 00:33:07,640
So this is map, then this one.

506
00:33:07,660 --> 00:33:08,770
So this one.

507
00:33:08,770 --> 00:33:10,240
And let's say this name is Peter.

508
00:33:11,080 --> 00:33:17,150
OK, so in this way, like you can see, there is there are many uses of beer class.

509
00:33:17,170 --> 00:33:19,210
OK, so beer glasses, very important.

510
00:33:20,980 --> 00:33:23,320
So it is very important, it is like.

511
00:33:24,610 --> 00:33:25,750
It is used heavily.

512
00:33:26,620 --> 00:33:31,760
OK, so you should know how to be in class and inside the class, two variables are there.

513
00:33:31,770 --> 00:33:34,400
There are only two variables first and second.

514
00:33:35,040 --> 00:33:39,180
OK, so we have only two variables inside the beer glass.

515
00:33:39,190 --> 00:33:40,260
So this is important.

516
00:33:40,270 --> 00:33:41,560
We have only two variables.

517
00:33:43,020 --> 00:33:49,890
OK, so they aim for solving this question was to introduce beer glass, and the second was to like

518
00:33:50,190 --> 00:33:51,740
how to solve this question, OK?

519
00:33:53,580 --> 00:33:56,040
So what is the time and the space complexity?

520
00:33:56,600 --> 00:33:58,860
So basically the complexity of this question.

521
00:33:59,910 --> 00:34:03,190
Is linear and space complexity, we are creating a strike.

522
00:34:03,540 --> 00:34:05,140
So it is big often.

523
00:34:05,430 --> 00:34:08,909
OK, so these are the time and the space complexity of this question.

524
00:34:10,370 --> 00:34:14,270
OK, so we will be using Berglas whenever we can.

525
00:34:14,630 --> 00:34:17,830
OK, so we will never create a class like this, OK?

526
00:34:18,560 --> 00:34:24,150
There is no need to write class code for ourself, so this is basically a waste of time.

527
00:34:25,610 --> 00:34:29,850
OK, so if you have any doubt in this question, you can ask me.

528
00:34:29,920 --> 00:34:31,400
OK, thank you.

