Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated:
1
00:00:00,690 --> 00:00:01,880
Okey, dokey.
2
00:00:01,920 --> 00:00:09,330
So in this exercise, what you are required to do is to develop a recursive function that receives an
3
00:00:09,330 --> 00:00:10,350
integer numb.
4
00:00:10,410 --> 00:00:16,050
OK, so probably the signature of the function is going to include enum.
5
00:00:16,230 --> 00:00:20,190
OK, now is the name of the variable end is the type of the variable.
6
00:00:20,640 --> 00:00:26,940
And also these function is going to receive not only numb, but also these function is going to receive
7
00:00:26,940 --> 00:00:27,660
a digit.
8
00:00:28,170 --> 00:00:31,230
OK, so function is going to receive two things.
9
00:00:31,470 --> 00:00:33,900
One is numb and two is digit.
10
00:00:34,950 --> 00:00:41,100
And this digit should represent basically any value between zero up to nine.
11
00:00:41,140 --> 00:00:44,430
OK, so zero one two three four five six seven eight nine.
12
00:00:45,030 --> 00:00:49,830
And the non variable can be basically whatever name you can think about.
13
00:00:49,830 --> 00:00:54,420
It can be of one digit to the digits, three digits and even seven digits.
14
00:00:55,080 --> 00:00:55,500
All right.
15
00:00:56,130 --> 00:00:59,400
So that's basically about what the function receives.
16
00:01:00,360 --> 00:01:03,150
But why aren't these recursive functions should do?
17
00:01:04,290 --> 00:01:09,630
All it has to do is that these functions should return to options.
18
00:01:10,170 --> 00:01:13,170
It can return either a zero or one.
19
00:01:13,410 --> 00:01:13,980
That's it.
20
00:01:14,100 --> 00:01:15,090
Only two options.
21
00:01:15,900 --> 00:01:25,320
The function is going to return one if the count of digit occurrences in NAM is even meaning if we have.
22
00:01:26,250 --> 00:01:34,380
We are basically going to go over each digit in our name and compare it with the actual digit that we
23
00:01:34,380 --> 00:01:34,980
received.
24
00:01:35,670 --> 00:01:44,550
And if the total count of digit occurrences in NAM will be even, then this function is going to return
25
00:01:44,550 --> 00:01:44,970
one.
26
00:01:45,690 --> 00:01:48,870
Otherwise, the function is going to return zero.
27
00:01:49,050 --> 00:01:56,250
Meaning if the number of digit occurrences in NAM itself is odd, then the function is going to return
28
00:01:56,370 --> 00:01:56,850
zero.
29
00:01:57,420 --> 00:02:01,140
So, for example, let's take a look at basic examples like this one.
30
00:02:02,040 --> 00:02:08,000
If we have no equals to twenty 124 and we have digit equals to two.
31
00:02:08,490 --> 00:02:12,470
OK, so now equals to one hundred and twenty four digit equals to two.
32
00:02:12,570 --> 00:02:20,040
That's one of the function received, and we are going to count how many times digit appears inside
33
00:02:20,040 --> 00:02:20,700
of these number.
34
00:02:20,700 --> 00:02:22,140
Digit number equals to two.
35
00:02:22,770 --> 00:02:25,860
In this case, we know that digit appears only once.
36
00:02:26,700 --> 00:02:32,430
So that means number or a total count of occurrences equals to one.
37
00:02:32,940 --> 00:02:35,880
That means it's an odd value.
38
00:02:36,180 --> 00:02:41,280
And that's why the function is expected to return the value of zero.
39
00:02:42,950 --> 00:02:49,820
Also, if we have another name, let's say, one two, three, four two and the digit equals again to
40
00:02:49,820 --> 00:02:50,120
two.
41
00:02:50,420 --> 00:02:57,470
Then we count how many times we have the how many occurrences of the digit we have inside of NAM, and
42
00:02:57,470 --> 00:03:02,300
we see that there is the first time in there is the second time, meaning a total of two times.
43
00:03:03,170 --> 00:03:07,250
That means that the function has two occurrences of the digits inside number.
44
00:03:07,670 --> 00:03:12,750
That's why two occurrences is an even number of occurrences.
45
00:03:12,770 --> 00:03:16,970
That's why the function is going to return one and also the same here.
46
00:03:17,120 --> 00:03:24,470
If we get the digit of zero and we see like one, two, three and four times the digit four occurrences
47
00:03:24,740 --> 00:03:25,160
even.
48
00:03:25,820 --> 00:03:27,650
And that's why we return one.
49
00:03:29,350 --> 00:03:32,740
So these are the instructions to develop a recursive function.
50
00:03:32,770 --> 00:03:38,020
Make sure you're not used the interactive approach of using loops for loops while loops don't use it.
51
00:03:39,040 --> 00:03:46,390
Probably because we need to develop a recursive function that will work with the recursion concept.
52
00:03:46,990 --> 00:03:50,590
OK, so with that being said, now is your time.
53
00:03:50,590 --> 00:03:55,030
Now is your turn to try and develop the use function on your own.
54
00:03:55,360 --> 00:04:02,760
And until the solutions VIDEO Keep on practicing, practice this, get better and become the best programmers
55
00:04:02,770 --> 00:04:04,600
you can be until the next time.
56
00:04:04,630 --> 00:04:06,250
My name is Vlad Lisa's alphabet.
57
00:04:06,310 --> 00:04:07,450
I'll see you in the next video.
5426
Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.