1
00:00:01,360 --> 00:00:03,040
Hey, guys, what's up?

2
00:00:03,580 --> 00:00:07,930
So today we are going to solve one more interesting pattern printing problem.

3
00:00:08,830 --> 00:00:15,700
So read and read in and we have to print below batton.

4
00:00:18,520 --> 00:00:22,080
So what is the burden so for any cause five.

5
00:00:22,270 --> 00:00:23,380
My pattern is.

6
00:00:24,810 --> 00:00:28,920
One, two, three, two.

7
00:00:30,690 --> 00:00:34,200
Three, four, five, four, three.

8
00:00:35,510 --> 00:00:45,890
Four, five, six, seven, six, five, four, five, six, seven, eight, nine, eight, seven,

9
00:00:46,070 --> 00:00:47,210
six, five.

10
00:00:48,690 --> 00:00:57,570
So if you remember, we have already sold this question and SolarWorld right now, if we will write

11
00:00:57,630 --> 00:01:01,320
the actual C++ code for solving this problem.

12
00:01:02,540 --> 00:01:07,180
So if you're looking at a league of the value of and there's five, I am renting five rows.

13
00:01:08,120 --> 00:01:13,070
OK, so I need a loop and this loop will run and times.

14
00:01:15,230 --> 00:01:19,940
OK, so how many species I have to print, I have to print.

15
00:01:20,390 --> 00:01:22,400
And minus eight species.

16
00:01:23,400 --> 00:01:26,120
OK, so I have to print and minus ice pieces.

17
00:01:27,060 --> 00:01:30,030
So for a year through, I have to print and minus a.

18
00:01:31,390 --> 00:01:33,120
Spaces then.

19
00:01:34,040 --> 00:01:37,640
Now, if you look at it fully, first, I am printing increasing numbers.

20
00:01:38,630 --> 00:01:40,410
So the numbers are increasing.

21
00:01:42,620 --> 00:01:45,680
So how many numbers, how many increasing numbers I have to print?

22
00:01:46,390 --> 00:01:47,910
So if the value of AI is five.

23
00:01:47,990 --> 00:01:49,970
I am printing five increasing numbers.

24
00:01:50,540 --> 00:01:51,410
So I have to print.

25
00:01:51,720 --> 00:02:00,290
I see increasing numbers from where to start starting from.

26
00:02:01,720 --> 00:02:03,000
Starting from I.

27
00:02:03,620 --> 00:02:09,180
So if you look carefully at the value of Phase five to the first number is five, if the value of AI

28
00:02:09,180 --> 00:02:10,790
is for the first number is.

29
00:02:11,390 --> 00:02:13,420
For now after this.

30
00:02:13,480 --> 00:02:15,460
I have to print decreasing numbers.

31
00:02:16,960 --> 00:02:18,960
I have to print decreasing numbers.

32
00:02:19,300 --> 00:02:21,370
So how many decreasing numbers I have to print.

33
00:02:21,940 --> 00:02:25,660
So if the value of I is four, I am printing three decreasing numbers.

34
00:02:26,260 --> 00:02:30,070
If the value of I use five, I am printing for decreasing numbers.

35
00:02:30,970 --> 00:02:34,900
So I have to print I minus one.

36
00:02:35,410 --> 00:02:37,310
Decreasing numbers.

37
00:02:39,360 --> 00:02:47,400
Now, from where to start, so the value of ICE five, I am starting from eight, which is the way minus

38
00:02:47,640 --> 00:02:47,910
two.

39
00:02:48,240 --> 00:02:49,830
Similarly, the value of AI is four.

40
00:02:49,920 --> 00:02:54,340
I am starting from six, which is the way minus two.

41
00:02:54,960 --> 00:02:55,810
So I am minus one.

42
00:02:55,830 --> 00:03:03,450
The closing numbers starting from the way minus two.

43
00:03:04,140 --> 00:03:06,790
Now w we have printed the entire row.

44
00:03:06,840 --> 00:03:10,830
When I printed the end bad I year through I have to go to next to lose.

45
00:03:10,890 --> 00:03:14,480
So I will print C out and lane.

46
00:03:15,330 --> 00:03:18,210
So in total how many loops do I need here.

47
00:03:18,840 --> 00:03:28,620
So I need one outer loop, one loop, four spaces, one loop for printing increasing numbers and when

48
00:03:28,620 --> 00:03:30,780
loop for printing decreasing numbers.

49
00:03:31,800 --> 00:03:32,010
OK.

50
00:03:32,160 --> 00:03:42,900
So in total I will need four loops out of which one loop is outer loop and the other three loops are

51
00:03:43,020 --> 00:03:43,530
in a loop.

52
00:03:46,030 --> 00:03:46,270
OK.

53
00:03:46,510 --> 00:03:49,960
So I think their logic and the problem is clear.

54
00:03:50,590 --> 00:03:51,610
So let say I called.

55
00:03:54,540 --> 00:03:56,450
So let us name this violence.

56
00:03:57,690 --> 00:04:00,460
No pattern to sue.

57
00:04:04,170 --> 00:04:07,320
Badon do not see BP.

58
00:04:23,120 --> 00:04:29,120
So first so first let us dig in, Burt Fundi User.

59
00:04:29,180 --> 00:04:34,910
So inten seen and seen.

60
00:04:35,000 --> 00:04:37,550
And now we have decided that.

61
00:04:39,090 --> 00:04:43,950
So first, I have to run a loop and times so fun.

62
00:04:44,190 --> 00:04:57,070
So for running a loop and times and time equals one while I is less than or equal to N and here I.

63
00:04:57,210 --> 00:04:57,780
Plus plus.

64
00:04:58,500 --> 00:04:59,550
So with the help of.

65
00:05:00,550 --> 00:05:08,840
These tea I when I left English to end and I plus plus this loop is going to run and times.

66
00:05:09,040 --> 00:05:11,410
Now each time this loop is running, I will print.

67
00:05:11,700 --> 00:05:12,110
I through.

68
00:05:12,940 --> 00:05:19,230
So for printing the ideal first I have to print and minus I space's ok.

69
00:05:19,510 --> 00:05:21,110
And minus ice pieces.

70
00:05:22,660 --> 00:05:35,800
So and Spees equals one vile space is less than or equal to two and minus eight pieces.

71
00:05:35,840 --> 00:05:38,680
So N minus I space's.

72
00:05:41,250 --> 00:05:44,760
Space plus space plus, plus.

73
00:05:46,200 --> 00:05:51,120
Now this loop will run and minus eight times, and each time this loop is running.

74
00:05:51,810 --> 00:05:54,120
What I will do, I will print a space.

75
00:05:57,270 --> 00:06:05,690
OK, so after printing spaces, what I have to do, I have to print I increasing numbers starting from

76
00:06:05,870 --> 00:06:09,500
I I increasing numbers starting from my.

77
00:06:09,590 --> 00:06:11,120
That means I need.

78
00:06:14,480 --> 00:06:20,200
So that means I need a loop and this loop will run eight times.

79
00:06:21,410 --> 00:06:25,660
Also, I need a value visual initially B I.

80
00:06:25,820 --> 00:06:30,500
Because you can see here, if the value of eyes for the first number that I have to print is four.

81
00:06:30,770 --> 00:06:32,570
So initially value equals I.

82
00:06:33,350 --> 00:06:35,570
And you can see here four.

83
00:06:35,630 --> 00:06:37,520
Then five, then six and then seven.

84
00:06:38,120 --> 00:06:42,140
So each time I am printing the value I will increase the value by one.

85
00:06:43,160 --> 00:06:45,230
So I at times I loop.

86
00:06:45,680 --> 00:06:49,940
Each time I will print so out value.

87
00:06:50,360 --> 00:06:51,260
Initially the values.

88
00:06:51,380 --> 00:06:52,760
I add value plus.

89
00:06:52,760 --> 00:06:53,090
Plus.

90
00:06:54,790 --> 00:06:55,770
So eight times.

91
00:06:55,860 --> 00:06:58,310
OK, so let's stick.

92
00:07:00,010 --> 00:07:04,240
So end value equals I.

93
00:07:04,630 --> 00:07:06,370
Because we have to start printing from.

94
00:07:06,490 --> 00:07:09,760
I know how many increasing numbers I.

95
00:07:09,880 --> 00:07:10,840
Increasing numbers.

96
00:07:10,960 --> 00:07:16,070
So end count equals one.

97
00:07:18,070 --> 00:07:23,180
While ground is less than or equal to how many.

98
00:07:23,230 --> 00:07:29,660
Using numbers I increasing numbers count plus plus.

99
00:07:30,370 --> 00:07:36,120
So each time this loop is running what I will do I will see out value.

100
00:07:36,660 --> 00:07:41,070
Now after printing that value, I have to increase the value by one.

101
00:07:42,630 --> 00:07:42,910
OK.

102
00:07:43,870 --> 00:07:47,530
So this loop is for printing the numbers in increasing orders.

103
00:07:48,460 --> 00:07:49,240
You can see here.

104
00:07:51,670 --> 00:07:53,580
So I have to run the loop eight times.

105
00:07:54,160 --> 00:08:00,220
So what I did, I take a variable count, which is initially one that I check counted less than I close

106
00:08:00,220 --> 00:08:00,720
to I.

107
00:08:00,820 --> 00:08:03,450
And then I did count plus plus.

108
00:08:03,880 --> 00:08:07,000
And each time this loop is running, I am printing value.

109
00:08:07,690 --> 00:08:10,210
And then I am increasing the value by when.

110
00:08:11,530 --> 00:08:20,040
So then then now I have to print a minus one, the closing numbers, I'm minus one, negative numbers.

111
00:08:20,770 --> 00:08:22,240
So for running.

112
00:08:22,300 --> 00:08:24,700
So I need a loop and this loop will run.

113
00:08:24,970 --> 00:08:28,400
How many number of times I minus one names.

114
00:08:29,440 --> 00:08:30,940
So I loop for running.

115
00:08:31,540 --> 00:08:34,660
So we need a loop that will run a minus one times.

116
00:08:34,960 --> 00:08:36,240
So what is the starting value.

117
00:08:37,150 --> 00:08:40,660
So starting value is the way minus two.

118
00:08:41,190 --> 00:08:41,710
Four, five.

119
00:08:41,750 --> 00:08:42,190
The starting.

120
00:08:42,190 --> 00:08:42,790
We lose it.

121
00:08:42,910 --> 00:08:44,140
Which is way minus two.

122
00:08:44,700 --> 00:08:47,530
Its value is initially the way minus two.

123
00:08:48,490 --> 00:08:48,710
Okay.

124
00:08:48,820 --> 00:08:52,840
And each time I am printing the value the value is decreased.

125
00:08:52,930 --> 00:08:54,640
Eight, seven, six and five.

126
00:08:54,700 --> 00:08:55,600
So what I will do.

127
00:08:56,320 --> 00:09:00,220
Value minus minus because the values are decreasing.

128
00:09:01,460 --> 00:09:05,740
So I am minus one times and the first we lose at the way minus two.

129
00:09:09,040 --> 00:09:11,210
So the first value.

130
00:09:13,120 --> 00:09:19,090
So the first value is to a minus two.

131
00:09:19,810 --> 00:09:21,730
And how many times I have to run the loop?

132
00:09:23,130 --> 00:09:24,360
A minus one times.

133
00:09:24,420 --> 00:09:32,790
So consequence one way count is less than or close to a minus one times.

134
00:09:32,820 --> 00:09:38,060
We have two in the loop so count plus plus.

135
00:09:38,880 --> 00:09:46,910
Now, each time this loop is learning, I have to see out value since the numbers are printed in the

136
00:09:46,910 --> 00:09:47,670
closing order.

137
00:09:48,300 --> 00:09:51,570
So value will be diclemente by one.

138
00:09:51,570 --> 00:09:53,070
So value minus minus.

139
00:09:54,240 --> 00:09:55,680
Now we have printed the spaces.

140
00:09:55,740 --> 00:09:57,330
We have been today increasing numbers.

141
00:09:57,360 --> 00:09:59,070
We have been decreasing the most.

142
00:10:00,030 --> 00:10:02,930
Now it is the right time to go to next line.

143
00:10:02,960 --> 00:10:04,440
So see out and line.

144
00:10:05,670 --> 00:10:07,230
So this is the complete.

145
00:10:09,040 --> 00:10:09,400
Called.

146
00:10:17,090 --> 00:10:20,780
OK, so this loop is for printing spaces.

147
00:10:22,280 --> 00:10:28,340
This loop is for printing increasing numbers and this loop is for printing decreasing numbers.

148
00:10:28,400 --> 00:10:29,600
OK, so let me write here.

149
00:10:36,820 --> 00:10:39,010
For spaces.

150
00:10:43,660 --> 00:10:48,940
Now, this is forward, increasing numbers.

151
00:10:52,440 --> 00:10:59,190
And this loop is for the closing numbers.

152
00:11:00,840 --> 00:11:01,120
OK.

153
00:11:01,710 --> 00:11:04,230
So let us test our program, how it is working.

154
00:11:08,540 --> 00:11:15,410
Let's say the value of this five, some output is correct, one down to three.

155
00:11:15,500 --> 00:11:19,760
In closing order, three, four, five, including order four, five, six, seven, inclosing order

156
00:11:20,300 --> 00:11:23,960
five, six, seven, eight, nine, including order and then decreasing orders.

157
00:11:25,180 --> 00:11:25,450
OK.

158
00:11:27,030 --> 00:11:29,930
Lettuce tested for more will lose.

159
00:11:32,410 --> 00:11:34,160
Let's say an enclosed tree.

160
00:11:35,960 --> 00:11:36,200
OK.

161
00:11:36,370 --> 00:11:39,400
So our court is a hundred percent correct.

162
00:11:41,970 --> 00:11:42,230
OK.

163
00:11:44,960 --> 00:11:46,280
So that is it for this video.

164
00:11:46,670 --> 00:11:47,190
Thank you.
