Login

All Problems

Problem title

Difficulty

Avg time to solve

Time To Burn Tree

Hard

50 mins

Sum Of Two Arrays

Easy

15 mins

Maximum Distance

Moderate

15 mins

Painter's Partition Problem

Moderate

25 mins

Rod cutting problem

Moderate

40 mins

Game of 3

Easy

30 mins

Sudoku Solver

Hard

25 mins

Missing and repeating numbers

Moderate

25 mins

Print Permutations - String

Easy

30 mins

Merge Two Sorted Linked Lists

Moderate

15 mins

Problem

Submissions

32

Avg. time to solve

30 min

Success Rate

70%

Problem Statement

```
Given:
‘N’ = 5, ‘ARR’ = [1, 2, 3, 4, 5].
The answer will be two since 8 since 8 pairs can be formed and those are (1,2), (1,5), (2,4), (4,5),(1,2,3), (3,4,5), (1,3,5), (2,3,4). Therefore the final answer is 8.
```

```
The first line of input contains an integer ‘T’ denoting the number of test cases.
The first line of each test case contains a single integer, ‘N,’ where ‘N’ is the number of elements of the array.
The second line of each test case contains ‘N’ space-separated integers, denoting the array elements.
```

```
For each test case, You are supposed to return an integer that denotes the total number of groups that can be formed.
```

```
You are not required to print the expected output; it has already been taken care of. Just implement the function.
```

```
1 <= ‘T’ <= 10
1 <= ‘N’ <= 10^4
0 <= ‘ARR[i]’ <= 10 ^ 4
Time Limit: 1sec.
```

```
2
5
1 2 3 4 5
3
3 3 3
```

```
8
4
```

```
In the first test case, The answer will be two since eight since 8 groups can be formed, and those are (1,2), (1,5), (2,4), (4,5),(1,2,3), (3,4,5), (1,3,5), (2,3,4). Therefore the final answer is 8.
In the second test case, The answer will be 4, since 4 groups can be formed, and those are (3,3), (3,3), (3,3), (3,3,3). Therefore the final answer is 4.
```

```
2
4
2 4 6 8
5
1 3 5 7 9
```

```
4
7
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code