1
00:00:00,580 --> 00:00:00,960
All right.

2
00:00:00,960 --> 00:00:05,140
So it's time for you to start writing some a race on your own and this problem set.

3
00:00:05,190 --> 00:00:10,270
I have a few challenges that cover arrays Array methods and array iteration.

4
00:00:10,560 --> 00:00:15,600
I'm going to introduce all the problems in this video first and then in the next video I'll go over

5
00:00:15,600 --> 00:00:21,240
the solutions as always the point here is that you attempt these on your own for these you are going

6
00:00:21,240 --> 00:00:22,540
to be writing code.

7
00:00:22,590 --> 00:00:28,260
I would do them in one giant file but it's up to you how you actually structure that.

8
00:00:28,380 --> 00:00:30,900
The first one is print reverse.

9
00:00:30,900 --> 00:00:33,770
So print reverse is a function that you'll need to write.

10
00:00:33,930 --> 00:00:39,870
That takes a single argument and that argument is assumed to be an array and all that the function needs

11
00:00:39,870 --> 00:00:47,340
to do is print that array one line at a time in reverse order so you can see printed reverse of the

12
00:00:47,340 --> 00:00:49,830
array ABC prints out.

13
00:00:49,830 --> 00:00:51,390
C B A.

14
00:00:51,930 --> 00:00:56,490
So that your hint here you need to use a loop.

15
00:00:56,490 --> 00:01:03,300
You can see here and the examples is uniform when we pass in an array of all one's returns true.

16
00:01:03,780 --> 00:01:07,590
But when we pass in an array it has a single two in it.

17
00:01:07,590 --> 00:01:09,180
Things are no longer identical.

18
00:01:09,270 --> 00:01:11,000
So we return false.

19
00:01:11,010 --> 00:01:11,870
Same thing here.

20
00:01:11,880 --> 00:01:13,770
This array is three letter B's.

21
00:01:13,950 --> 00:01:16,110
So those are identical or uniform.

22
00:01:16,110 --> 00:01:17,760
So we return true.

23
00:01:17,760 --> 00:01:19,840
In this case they're not the same Muhtar.

24
00:01:19,860 --> 00:01:21,510
So it returns false.

25
00:01:21,510 --> 00:01:26,520
Your head here is that you'll want to use a loop and more importantly you want to have a variable that

26
00:01:26,520 --> 00:01:32,010
just keeps track of the very first item in the index and then you'll compare that in the loop to the

27
00:01:32,010 --> 00:01:32,910
next item.

28
00:01:33,330 --> 00:01:37,260
And then if that are equal to compared to the next one into the next one and if at any point they're

29
00:01:37,260 --> 00:01:41,610
not equal then you're just done return false.

30
00:01:41,610 --> 00:01:47,790
Next up is some array some array is a function that should take an array and it's going to be assumed

31
00:01:47,790 --> 00:01:49,800
that the array is full of numbers.

32
00:01:49,860 --> 00:01:54,090
All you need to do is add the numbers up and return the sum.

33
00:01:54,120 --> 00:02:01,770
You can see here some array of one to three is equal to one plus two plus three which returns six.

34
00:02:01,890 --> 00:02:05,550
You're hinting is that you need to use a loop and pretty much all this you need a loop.

35
00:02:05,790 --> 00:02:12,600
And also you want to have a variable called result or answer or some where you're going to store the

36
00:02:12,600 --> 00:02:15,890
answer and constantly add into it each time through the loop.

37
00:02:16,170 --> 00:02:18,640
The last problem in the set is Max.

38
00:02:18,900 --> 00:02:24,630
So Max is a function that should also accept an array and you can assume the arrays all numbers and

39
00:02:24,630 --> 00:02:28,510
all that it needs to do is return the maximum number in that array.

40
00:02:28,770 --> 00:02:35,820
So as you can see here when we give it one two and three in a single array we get three returned because

41
00:02:35,820 --> 00:02:38,460
that's the maximum of that array.

42
00:02:38,460 --> 00:02:45,500
Likewise when we do it here 10 3 10 and 4 we return 10 because it's a maximum in that array.

43
00:02:45,870 --> 00:02:51,120
So the hint again no need to use a loop and you'll need to use a variable that's going to be storing

44
00:02:51,120 --> 00:02:55,980
your maximum number and every time through the loop you'll need to update that variable.

45
00:02:56,130 --> 00:03:00,490
If the current number in the loop is greater than the old maximum.

46
00:03:00,510 --> 00:03:03,260
All right so that's it for this problem set.

47
00:03:03,270 --> 00:03:07,170
I strongly encourage that you take the time to do these they're picked.

48
00:03:07,170 --> 00:03:09,270
They're designed at a very particular way.

49
00:03:09,270 --> 00:03:13,920
They're going to help you a lot if you just stop and spend half an hour or an hour attempting these

50
00:03:13,920 --> 00:03:15,750
problems in the next video.

51
00:03:15,750 --> 00:03:18,550
I'm going to go over the solutions as always starting from scratch.
