1
00:00:00,720 --> 00:00:01,650
Hi everyone.

2
00:00:01,650 --> 00:00:07,860
Let's do this question given an array of strings consisting of lowercase English letters.

3
00:00:07,890 --> 00:00:10,140
Group the anagrams together.

4
00:00:10,140 --> 00:00:12,780
You can return the answer in any order.

5
00:00:12,780 --> 00:00:19,230
An anagram is a word or phrase formed by rearranging the letters of a different word or phrase, using

6
00:00:19,230 --> 00:00:21,780
all the original letters exactly once.

7
00:00:21,780 --> 00:00:27,120
For example, you have Ark over here and you have car over here, so you can see that when you see,

8
00:00:27,120 --> 00:00:27,960
look at the letters.

9
00:00:27,960 --> 00:00:31,800
So you have a ark, and in car also you have ark.

10
00:00:31,800 --> 00:00:33,210
So these are anagrams.

11
00:00:33,210 --> 00:00:33,630
All right.

12
00:00:33,630 --> 00:00:35,130
So these two are anagrams.

13
00:00:35,130 --> 00:00:39,030
Now the question says that we are given an array of strings.

14
00:00:39,030 --> 00:00:40,560
So this is the array of strings.

15
00:00:40,560 --> 00:00:45,150
And we have in it strings consisting of lowercase English letters.

16
00:00:45,150 --> 00:00:48,990
Now in you in this array we have to group the anagrams together.

17
00:00:48,990 --> 00:00:50,100
So that's this question.

18
00:00:50,100 --> 00:00:54,150
For example you can see a or C and C are these two are anagrams.

19
00:00:54,150 --> 00:00:55,380
So they have to be grouped together.

20
00:00:55,380 --> 00:00:57,180
So we have this array over here.

21
00:00:57,180 --> 00:01:00,000
And then Cat Act and ATC.

22
00:01:00,030 --> 00:01:00,990
These are anagrams.

23
00:01:00,990 --> 00:01:03,210
So these three strings are grouped together.

24
00:01:03,210 --> 00:01:05,250
And then we have just a b c over here.

25
00:01:05,250 --> 00:01:06,960
And then this array has to be returned.

26
00:01:06,960 --> 00:01:08,130
So that is this question.

27
00:01:08,130 --> 00:01:10,770
Now let's go ahead and write a few test cases.

28
00:01:10,770 --> 00:01:12,450
We have already seen this test case.

29
00:01:12,450 --> 00:01:16,770
If this is the array which is given to us, then this is the output that we have to give back.

30
00:01:16,770 --> 00:01:21,150
Now let's say the array which is given to us has just one string in it.

31
00:01:21,150 --> 00:01:24,270
In that case, we can have only one group.

32
00:01:24,270 --> 00:01:27,150
And that group is going to have just this particular string in it.

33
00:01:27,150 --> 00:01:27,450
Right.

34
00:01:27,450 --> 00:01:29,550
So this is going to be the output in this case.

35
00:01:29,550 --> 00:01:35,910
And if the array which is given to us is going to be empty, then we cannot make anything else except

36
00:01:35,910 --> 00:01:39,150
this one group which is also having an empty string inside it.

37
00:01:39,150 --> 00:01:40,620
So this is going to be the output.

38
00:01:40,620 --> 00:01:41,010
All right.

39
00:01:41,010 --> 00:01:46,920
So we have understood the question and we have gone ahead and taken a look at a few test cases in the

40
00:01:46,920 --> 00:01:47,640
next video.

41
00:01:47,640 --> 00:01:50,280
Let's try to think how we can solve this question.
