1
00:00:02,070 --> 00:00:02,760
Hi, everyone.

2
00:00:02,790 --> 00:00:07,740
So in the last video, we discussed this question, can't the occurrence of an element and we also write

3
00:00:07,740 --> 00:00:08,170
the code.

4
00:00:08,670 --> 00:00:11,310
So this was the code current function.

5
00:00:11,550 --> 00:00:17,250
I was passing a variable by reference and I was updating that variable, and then I'm bringing my answer

6
00:00:17,250 --> 00:00:19,140
variable inside the main function.

7
00:00:19,350 --> 00:00:21,170
So there is another way to solve this question.

8
00:00:21,480 --> 00:00:22,960
So how we can solve this question.

9
00:00:24,180 --> 00:00:24,990
So what we will do.

10
00:00:25,740 --> 00:00:32,770
So first of all, this is an Mexi, so I will check whether X is present at this index or not.

11
00:00:33,270 --> 00:00:43,830
So if Elfy is equal to X, so if this is a situation, what I will do, I will return one plus.

12
00:00:45,820 --> 00:00:53,050
The number of times is present in this area, so I will call the guys on this area and we're just decided

13
00:00:53,050 --> 00:00:56,790
the cities function E and I bless them.

14
00:00:57,310 --> 00:01:03,660
So this function, this occasion will give me how many times X is appearing inside this, Eddie.

15
00:01:05,170 --> 00:01:11,620
And since X is also present at this position, so I will do one plus whatever the answer, the question

16
00:01:11,620 --> 00:01:18,970
will return me in the ls part, what I will do, return zero because X is not present here.

17
00:01:19,000 --> 00:01:23,730
So return zero plus the number of times X is present in this area.

18
00:01:24,820 --> 00:01:28,080
So the equation will give me how many times X is present in this area.

19
00:01:28,450 --> 00:01:36,910
So I will call function and I plus one type of my function will be void so that I don't know the function

20
00:01:36,910 --> 00:01:43,120
is sorry, the head of the function is void, but in this case they're able to function will be deja

21
00:01:43,570 --> 00:01:44,080
will return.

22
00:01:44,080 --> 00:01:47,480
How many times the element is present I'm repeating again.

23
00:01:47,710 --> 00:01:51,890
So first of all, I will check whether X is present at this index or not.

24
00:01:52,150 --> 00:01:59,410
So if it is present, then I will return one plus the number of times X is present inside the city.

25
00:01:59,590 --> 00:02:04,840
So the equation will return how many times X is appearing and I will do one, plus I will return one

26
00:02:04,840 --> 00:02:06,700
plus because X is also present here.

27
00:02:07,060 --> 00:02:09,960
Otherwise you need to call the equation on this area.

28
00:02:11,110 --> 00:02:13,410
But since X is not present at this next.

29
00:02:13,450 --> 00:02:14,090
So that's right.

30
00:02:14,170 --> 00:02:18,640
Zero plus or if you don't want to write, you can remove zero from zero.

31
00:02:19,480 --> 00:02:20,950
So you can just click on.

32
00:02:22,890 --> 00:02:29,130
So let us write the code, so in order to have the function will be integer, we are going to return

33
00:02:29,130 --> 00:02:31,590
how many times the element does present the name?

34
00:02:31,620 --> 00:02:34,580
The function is count two.

35
00:02:36,870 --> 00:02:37,860
So let's do one thing.

36
00:02:37,860 --> 00:02:39,330
Let's copy this entire function.

37
00:02:40,920 --> 00:02:47,520
And then we will change inside dysfunction, so first change that we need to do is basically the name

38
00:02:47,520 --> 00:02:52,590
of the function is going to we will not take a variable answer.

39
00:02:53,520 --> 00:02:54,510
We will return.

40
00:02:54,660 --> 00:02:55,620
How many times?

41
00:02:57,510 --> 00:03:01,390
It is present, so if I become a question, I will return zero.

42
00:03:02,250 --> 00:03:06,960
Similarly here what I will do so return one.

43
00:03:07,590 --> 00:03:09,950
Plus I'm writing this corrugated one.

44
00:03:09,960 --> 00:03:11,970
Plus it's copied this.

45
00:03:14,940 --> 00:03:16,050
Quality can't function.

46
00:03:17,630 --> 00:03:21,320
So can't function will give me how many times the element of surprise inside count to.

47
00:03:22,690 --> 00:03:23,860
And in the early part.

48
00:03:32,640 --> 00:03:37,980
So in the part, I will return zero plus count to function.

49
00:03:39,470 --> 00:03:46,880
And remove the answer variable, so I'm writing this here, OK, and this is the best case exactly like

50
00:03:46,880 --> 00:03:50,330
this, but here it by percentages, so I'm returning zero.

51
00:03:51,900 --> 00:03:57,540
Simple, so zero plus doesn't have any significance, so you can remove zero from here, so let's do

52
00:03:57,540 --> 00:03:59,550
that and then let's try to Rahnavard.

53
00:04:03,880 --> 00:04:05,050
So let's call the function.

54
00:04:07,220 --> 00:04:12,500
Count two, so let's remove answer.

55
00:04:17,120 --> 00:04:20,899
Let's move on set here and let us also this dysfunction.

56
00:04:23,880 --> 00:04:25,800
And let's name this function count only.

57
00:04:33,730 --> 00:04:34,630
So let's spend.

58
00:04:35,850 --> 00:04:37,680
See out the name of the function is called.

59
00:04:41,340 --> 00:04:42,920
So Ben is not pleasant.

60
00:04:42,970 --> 00:04:44,600
Inside, there is output should be zero.

61
00:04:46,680 --> 00:04:47,790
So we are getting zero.

62
00:04:52,460 --> 00:04:58,640
OK, so let's change the value, let's say five, so five is present three times.

63
00:05:00,520 --> 00:05:06,660
So we are getting three now, let's try four, six, six, two times in the area.

64
00:05:08,720 --> 00:05:10,350
So percent two times now.

65
00:05:10,370 --> 00:05:14,460
Let's check what, seven seven is present only one time, so I should get one.

66
00:05:16,100 --> 00:05:17,170
So I am getting one.

67
00:05:17,750 --> 00:05:19,490
So basically our function is working.

68
00:05:19,880 --> 00:05:21,130
So this is the end record.

69
00:05:21,350 --> 00:05:23,490
So this is not their way of writing the function.

70
00:05:23,990 --> 00:05:25,330
So this is it from this video.

71
00:05:25,370 --> 00:05:26,600
I will see you in the next one.

