Want to solve this problem? Login now to get access to solve the problems

Problem

Submissions

Solution

Leaderboard

Coming soon

2

Difficulty: EASY

Avg. time to solve

15 min

Success Rate

85%

Problem Statement

Suggest Edit

```
A person can only work on a single activity at a time. The start time of one activity can coincide with the end time of another.
```

```
The first line contains an integer 'T' denoting the number of test cases or queries to be run.
The first line of each test case or query contains a single integers 'N' denoting the number of activities.
The second line of each test case contains N single space separated integers denoting the starting time of N activities respectively.
The third line of each test case contains N single space separated integers denoting the finishing time of N activities respectively.
```

```
For each test case, print the maximum number of activities a single person can perform.
```

```
1 <= T <= 5
1 <= N <= (10^5)
0 <= Start[i] < Finish[i] <= (10^9)
```

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

```
3
1
```

```
For test case 1:
A person can perform maximum 3 activities, by performing the activities in the given order 1 - > 3 -> 2.
For test case 2:
As the starting of all the activities is the same, a person can perform maximum 1 activity.
```

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

```
4
1
```

Want to solve this problem? Login now to get access to solve the problems