1
00:00:01,400 --> 00:00:03,110
Hello, everyone, welcome to the station.

2
00:00:03,140 --> 00:00:06,160
So today we will solve one more problem with the help of regulation.

3
00:00:06,170 --> 00:00:08,300
So the name of the problem is currency rules.

4
00:00:09,140 --> 00:00:11,590
OK, so what is the problem?

5
00:00:11,650 --> 00:00:17,410
So the problem is very simple, given a no, let's say the number is one zero three two zero.

6
00:00:17,750 --> 00:00:20,310
So we have to calculate how many zeros are present.

7
00:00:20,330 --> 00:00:24,200
So in this case, our output will be to OK, because there are two zeros.

8
00:00:25,780 --> 00:00:31,690
OK, now let's take one more example of the Valley of and let's say 123, then the output will be zero

9
00:00:31,720 --> 00:00:33,380
because there are no zero present.

10
00:00:33,640 --> 00:00:35,440
OK, so I hope you got the problem.

11
00:00:35,450 --> 00:00:39,430
We just have to count the number of zeros present inside the number.

12
00:00:39,740 --> 00:00:42,160
OK, now how we can solve this problem.

13
00:00:42,340 --> 00:00:45,700
So basically what we have to do, we will go to each and every digit.

14
00:00:46,090 --> 00:00:47,930
We will go to each and every digit.

15
00:00:47,950 --> 00:00:51,560
And if the digit is zero, we will do our answer.

16
00:00:51,590 --> 00:00:52,300
Plus, plus.

17
00:00:52,350 --> 00:00:56,080
OK, so this was the approach that we are using for loop or divine loop.

18
00:00:56,110 --> 00:00:59,740
OK, now we will use a similar approach if we are using regression also.

19
00:01:00,130 --> 00:01:05,349
So what we will do so given the number, let's say the number is one zero three two zero only.

20
00:01:05,860 --> 00:01:07,420
So what I will do so.

21
00:01:08,560 --> 00:01:13,750
I will tell that equation, give me how many zeros are present in this modern world, so Dacogen will

22
00:01:13,750 --> 00:01:19,210
give me that answer for this is one, OK, because they are the ones you represent, then what we will

23
00:01:19,210 --> 00:01:22,150
do, we will check the last date, OK?

24
00:01:22,370 --> 00:01:25,510
We will check this last digit.

25
00:01:27,110 --> 00:01:29,100
OK, so this last digit is zero.

26
00:01:29,120 --> 00:01:31,700
So what we will do, we will do one plus one.

27
00:01:31,760 --> 00:01:34,590
OK, since the last year to zero, we will do plus one.

28
00:01:34,730 --> 00:01:36,110
So the answer will become to.

29
00:01:37,100 --> 00:01:40,590
OK, so this is how this court will work if you want to.

30
00:01:40,610 --> 00:01:41,780
So this will be.

31
00:01:42,730 --> 00:01:48,700
Now, this is the function and zeroes, it will take a number and an argument what I will do.

32
00:01:49,120 --> 00:01:55,450
So this Consuelo's function calculates the count, the number of zeros present inside the number.

33
00:01:55,450 --> 00:01:57,690
And so I will give the smaller input.

34
00:01:57,940 --> 00:02:01,280
So it will give me how many zeros are present in the number and by ten.

35
00:02:01,570 --> 00:02:02,620
So this is basically.

36
00:02:02,620 --> 00:02:03,250
And Martin.

37
00:02:05,140 --> 00:02:07,270
OK, so this will be our problem.

38
00:02:07,690 --> 00:02:12,010
This will be done for a similar problem and then we will check the last digit.

39
00:02:12,280 --> 00:02:17,210
OK, so I will check if the last digit in this case, it is zero here.

40
00:02:17,230 --> 00:02:23,380
So if the last digit is zero, what we will do, we will add plus one to our answer.

41
00:02:23,410 --> 00:02:25,450
So this was our smaller answer.

42
00:02:26,710 --> 00:02:30,640
So what we will do, we will do smaller answered plus plus.

43
00:02:30,640 --> 00:02:32,440
Or we can write a smaller answer plus one.

44
00:02:33,040 --> 00:02:36,370
In the last part you will simply return a smaller answer.

45
00:02:37,850 --> 00:02:43,880
OK, if the latter it is not, you don't we will not do plus one, so we will simply return small answer.

46
00:02:44,960 --> 00:02:48,970
OK, and later the president, we will dance a plus one.

47
00:02:49,340 --> 00:02:51,010
Let's see how this code will work.

48
00:02:51,320 --> 00:02:53,780
So, OK, so one zero three two zero.

49
00:02:53,780 --> 00:02:55,220
Let's take this example only.

50
00:02:55,730 --> 00:02:59,830
So I have this example one zero three two one zero.

51
00:03:00,470 --> 00:03:04,820
So big the problem, the smaller part with qualification on this part.

52
00:03:05,420 --> 00:03:06,500
OK, so.

53
00:03:07,710 --> 00:03:11,010
This will become one 032 then again.

54
00:03:13,250 --> 00:03:19,640
You a smaller part, so this will become one zero three again, colocation, a smaller part, so this

55
00:03:19,640 --> 00:03:23,140
will become then again called education on the smaller part.

56
00:03:23,660 --> 00:03:27,610
So this will become one again, called education, the smaller part.

57
00:03:27,830 --> 00:03:29,070
So this part is zero.

58
00:03:29,450 --> 00:03:31,520
So I'm calling on zero now.

59
00:03:31,550 --> 00:03:33,170
This will become our base case.

60
00:03:35,280 --> 00:03:37,140
So what will happen, I will return zero.

61
00:03:38,200 --> 00:03:44,350
OK, now we will check the last digit losses of this one, so simply return the smaller answer, we

62
00:03:44,350 --> 00:03:45,460
will check the last digit.

63
00:03:45,700 --> 00:03:46,700
The last digit is zero.

64
00:03:46,720 --> 00:03:49,510
So what we will do a smaller answer plus one.

65
00:03:50,140 --> 00:03:52,340
So we will return zero plus one, which is one.

66
00:03:52,630 --> 00:03:53,880
Now, check the last digit.

67
00:03:53,890 --> 00:03:55,110
It is not zero.

68
00:03:55,510 --> 00:03:58,660
So I will simply return this my answer, which is one only.

69
00:03:58,990 --> 00:04:01,370
OK, now check the last budget, which is two.

70
00:04:01,710 --> 00:04:03,950
So we will simply return the smaller answer.

71
00:04:05,140 --> 00:04:06,400
Now check the last digit.

72
00:04:06,430 --> 00:04:07,300
So this is zero.

73
00:04:07,420 --> 00:04:08,610
So we will add plus one.

74
00:04:08,920 --> 00:04:10,810
So this will become one plus one which is.

75
00:04:11,050 --> 00:04:12,250
So too is our answer.

76
00:04:12,620 --> 00:04:14,740
OK, so that's all very simple.

77
00:04:15,070 --> 00:04:17,010
OK, now let us write the code.

78
00:04:18,510 --> 00:04:22,800
So what will the return type we all know that will be integer.

79
00:04:23,350 --> 00:04:26,200
Let's say the name of the function is count zeros.

80
00:04:27,180 --> 00:04:32,310
What it will take, it will take a number and as argument again, three simple steps.

81
00:04:32,940 --> 00:04:35,910
First, the best case, not now the base case is very simple.

82
00:04:35,910 --> 00:04:39,600
If the value of and zero, we will return zero.

83
00:04:42,460 --> 00:04:45,700
If the value now it's time for the recursive case.

84
00:04:48,160 --> 00:04:53,170
So what does a recursive case, so the recursive case, what we talked about.

85
00:04:53,200 --> 00:04:54,940
OK, so what is the recursive case?

86
00:04:55,690 --> 00:04:57,520
So small answer.

87
00:05:00,840 --> 00:05:03,540
Calculate the zeros present in the number.

88
00:05:04,670 --> 00:05:06,080
And by 10:00, OK.

89
00:05:06,110 --> 00:05:12,350
So we are calculating the zero spending then and then and then our calculation part.

90
00:05:15,150 --> 00:05:19,830
So what is the calculation part we will use if handled so if the last digit?

91
00:05:19,860 --> 00:05:22,560
OK, so first of all, let's calculate the last digit.

92
00:05:25,380 --> 00:05:29,100
So the last digit is and more than.

93
00:05:30,330 --> 00:05:33,870
So the last two days and more than now, we will check.

94
00:05:34,440 --> 00:05:38,490
So if the last digit equals equals zero.

95
00:05:39,560 --> 00:05:42,140
What we will do, so our answer will become.

96
00:05:43,280 --> 00:05:45,740
We will return one plus small answer.

97
00:05:47,100 --> 00:05:51,630
Otherwise, in that last part, we will simply return our smaller answer.

98
00:05:52,360 --> 00:05:52,730
OK.

99
00:05:55,760 --> 00:05:57,740
It will simply tear down our small lanser.

100
00:05:59,240 --> 00:06:01,400
OK, so this is very simple called.

101
00:06:03,220 --> 00:06:05,080
Now, let's call this function.

102
00:06:11,350 --> 00:06:14,750
So let's say the value is one zero three two zero only.

103
00:06:14,840 --> 00:06:15,250
OK.

104
00:06:17,020 --> 00:06:21,040
OK, so let's make one zero two zero only.

105
00:06:21,070 --> 00:06:23,770
OK, now let's turn our file.

106
00:06:26,310 --> 00:06:31,080
So I thought this coming out to be true because there are two groups present in the number.

107
00:06:31,160 --> 00:06:36,910
OK, now let's now we will try it in our court and we will make the diagram.

108
00:06:38,580 --> 00:06:40,500
OK, so one more thing in this question.

109
00:06:40,500 --> 00:06:43,140
The value of and will be good in order to win.

110
00:06:43,210 --> 00:06:46,170
OK, so this is given OK, this is the end.

111
00:06:46,170 --> 00:06:47,460
But this is the constraint.

112
00:06:47,460 --> 00:06:50,640
The value of and will be given will be greater than or equal to one.

113
00:06:50,760 --> 00:06:52,640
OK, now let's bring our code.

114
00:06:53,430 --> 00:06:55,570
So let's take a different example.

115
00:06:55,970 --> 00:06:59,520
OK, let's say the value is two zero zero two.

116
00:07:01,400 --> 00:07:04,340
Let's say the number is 002, so our answer should be two.

117
00:07:04,670 --> 00:07:05,080
OK.

118
00:07:06,310 --> 00:07:07,240
Now, what will happen?

119
00:07:07,270 --> 00:07:13,290
So this is not close to zero, so we will we will call this function the smaller part.

120
00:07:13,300 --> 00:07:15,760
So I am calling this function on 200.

121
00:07:16,570 --> 00:07:18,700
This function will wait at line number 10.

122
00:07:19,330 --> 00:07:21,220
Again, this function will be a third line number.

123
00:07:21,230 --> 00:07:22,690
Then we will call on 20.

124
00:07:23,590 --> 00:07:29,920
Dysfunctional with a headline number 10, we will call on two dysfunctional with a headline number 10,

125
00:07:30,220 --> 00:07:31,390
it will call on zero.

126
00:07:32,070 --> 00:07:34,700
OK, so we will hit the basics here.

127
00:07:34,720 --> 00:07:35,890
OK, we are hitting the best.

128
00:07:36,250 --> 00:07:37,330
It is returning zero.

129
00:07:38,700 --> 00:07:45,710
It is returning zero to our small answer is zero and then the last digit and more then so the last budget

130
00:07:45,750 --> 00:07:47,520
is two more 10, which is two.

131
00:07:48,060 --> 00:07:50,190
OK, so two is not close to zero.

132
00:07:50,200 --> 00:07:52,100
So we'll simply return the small answer.

133
00:07:52,110 --> 00:07:53,670
So we'll simply return zero.

134
00:07:53,850 --> 00:07:56,090
OK, we are simply returning zero.

135
00:07:56,970 --> 00:07:58,300
My answer is zero.

136
00:07:58,860 --> 00:08:01,760
Then again, we will calculate the last digit.

137
00:08:01,880 --> 00:08:04,100
OK, dysfunctional waiting hard line number 10.

138
00:08:04,410 --> 00:08:10,860
Now it will come to line number 13 will calculate the last digit and then so that it is zero if the

139
00:08:10,860 --> 00:08:11,760
last digit is zero.

140
00:08:11,790 --> 00:08:14,190
We are returning one plus smart answer.

141
00:08:14,580 --> 00:08:16,020
So zero plus one.

142
00:08:17,250 --> 00:08:18,180
So we are returning.

143
00:08:18,180 --> 00:08:20,280
Well now the answer becomes one.

144
00:08:20,710 --> 00:08:24,830
OK, again, we will check the last digit losses at a zero.

145
00:08:25,320 --> 00:08:32,700
So we will return when plus small answer which is to OK, so our small answer is to know the last digit

146
00:08:32,700 --> 00:08:34,640
as to who is not close to zero.

147
00:08:34,679 --> 00:08:36,640
So it will simply return the small answer.

148
00:08:36,659 --> 00:08:39,179
So will simply return to OK.

149
00:08:39,179 --> 00:08:40,650
And this is our answer.

150
00:08:40,710 --> 00:08:42,700
OK, so it is working fine.

151
00:08:43,470 --> 00:08:46,200
OK, so I hope you understood this problem also.

152
00:08:46,660 --> 00:08:48,720
OK, if you have any doubt you can ask me.

153
00:08:55,240 --> 00:08:59,520
OK, so I hope you understand this problem, so if you have any doubt, you can definitely ask me,

154
00:08:59,560 --> 00:08:59,860
OK?

155
00:09:00,100 --> 00:09:00,580
Thank you.

