1
00:00:02,150 --> 00:00:02,630
All right.

2
00:00:02,630 --> 00:00:05,880
Let me show you how I'm going to solve this particular challenge.

3
00:00:05,900 --> 00:00:07,340
So let's get started.

4
00:00:07,430 --> 00:00:15,290
First of all, create a function to find the maximum of two numbers so I can get my function name from

5
00:00:15,290 --> 00:00:16,400
the first statement.

6
00:00:16,430 --> 00:00:19,300
The function to find maximum number.

7
00:00:19,310 --> 00:00:21,570
So here we go.

8
00:00:21,590 --> 00:00:24,830
So for this one, we can do it in two ways.

9
00:00:24,900 --> 00:00:25,300
Okay.

10
00:00:25,400 --> 00:00:31,390
Just using the if statement or using the built in math function or method.

11
00:00:31,400 --> 00:00:34,610
So let me use the normal if statement to check for this.

12
00:00:34,610 --> 00:00:35,090
Right.

13
00:00:35,090 --> 00:00:38,030
So let's say solution one for this one.

14
00:00:38,850 --> 00:00:44,430
So like I said, there are so many ways to kill a cat or so many ways to get something done.

15
00:00:45,150 --> 00:00:47,130
So let's use normal function.

16
00:00:47,220 --> 00:00:51,840
And then the name of my function here as maximum number.

17
00:00:52,110 --> 00:00:59,640
Let's say get maximum, maximum, maximum number.

18
00:01:00,480 --> 00:01:09,480
And this function would take, what, two numbers that is number one and then number two and then my

19
00:01:09,480 --> 00:01:10,350
parentheses.

20
00:01:10,350 --> 00:01:21,900
And here I would check if the number one is more than number two, then I'm going to return number one.

21
00:01:23,050 --> 00:01:26,280
Number one else here else?

22
00:01:27,300 --> 00:01:29,910
Then I return.

23
00:01:30,090 --> 00:01:32,040
And number two, that is it.

24
00:01:32,040 --> 00:01:33,240
So I'm done with the first one.

25
00:01:33,240 --> 00:01:36,840
So let me save it here and now.

26
00:01:36,840 --> 00:01:38,310
Let me call the function.

27
00:01:38,310 --> 00:01:46,710
So cost, let's say result is equal to get maximum number.

28
00:01:46,740 --> 00:01:52,080
Then I want to find these numbers, let's say 20 and 40.

29
00:01:52,110 --> 00:01:53,760
Which of these is larger?

30
00:01:54,390 --> 00:01:56,700
So let's consider, look and see.

31
00:01:56,700 --> 00:01:57,630
This is easy.

32
00:01:57,980 --> 00:01:59,100
Is it challenged?

33
00:01:59,970 --> 00:02:04,380
So let's say it's 40 because on the fly we know that it's 40.

34
00:02:05,520 --> 00:02:11,640
Okay, so let's use the the built in method to get this one done also.

35
00:02:11,670 --> 00:02:14,460
So command this one.

36
00:02:14,460 --> 00:02:16,800
And now let me also comment this one.

37
00:02:16,800 --> 00:02:18,540
Okay, I can maintain it.

38
00:02:19,200 --> 00:02:24,480
And my solution number one is this one and then come down here and solution number two.

39
00:02:24,990 --> 00:02:36,240
So the same way gets maximum function sorry, my function keyword and then get maximum number two and

40
00:02:36,240 --> 00:02:44,190
then the same way it would take in number one and then the number two and then my parentheses.

41
00:02:44,340 --> 00:02:54,540
So this one returned quickly from this function math third maximum, then I'll pass in my number one

42
00:02:54,540 --> 00:03:01,260
and then my number two, which is the since that this one is shorter than the the first one here we

43
00:03:01,260 --> 00:03:07,500
have two lines of code and this one you have at least I mean, one, two, three, four or five lines

44
00:03:07,500 --> 00:03:07,950
of code.

45
00:03:07,950 --> 00:03:09,510
This is ideal way to go.

46
00:03:09,600 --> 00:03:15,060
So the same way if I call it a function here, down here, let me comment this one out.

47
00:03:15,390 --> 00:03:19,230
And now let's say check for the results.

48
00:03:19,830 --> 00:03:23,430
Let's consider that log the result.

49
00:03:23,460 --> 00:03:24,420
This is number two.

50
00:03:24,420 --> 00:03:26,250
Let me call this as that yet.

51
00:03:26,490 --> 00:03:30,180
So if I call if I cancel, log the results.

52
00:03:31,980 --> 00:03:33,420
It's 240.

53
00:03:33,420 --> 00:03:35,490
That is it about the first challenge.

54
00:03:35,820 --> 00:03:37,320
So the next challenge is what?

55
00:03:37,320 --> 00:03:38,430
The minimum.

56
00:03:38,650 --> 00:03:43,920
Okay, so I can copy this one comment.

57
00:03:43,920 --> 00:03:50,760
It come down here and change this one to minimum because find a minimum here.

58
00:03:50,790 --> 00:03:53,420
If I save it, I get 20.

59
00:03:53,430 --> 00:03:55,590
So the same way for this one too.

60
00:03:55,620 --> 00:03:57,540
We can copy this one here.

61
00:03:58,620 --> 00:04:09,420
And then come down here and let's say this one now I can reverse the sun as lesson and then if I console.log

62
00:04:09,420 --> 00:04:14,760
this one, let's see, I still have 20 hours before.

63
00:04:14,790 --> 00:04:16,950
That is a simple coding challenge.

64
00:04:17,160 --> 00:04:23,220
The next video, let's have a look at another coding challenge of which we are going to increase the

65
00:04:23,220 --> 00:04:24,840
complexity of it a little bit.

66
00:04:24,870 --> 00:04:26,490
Catch up the next video.

