# Maximum Distinct Blocks

Posted: 13 Mar, 2021
Difficulty: Easy

## PROBLEM STATEMENT

#### For example:

``````Consider the array ARR = { 0, 2, 1 } having 3 elements.
Starting at Block 0, you can move to only Block 0 and you cannot move to any other blocks.
Starting at Block 1, you can move between Block 1 and Block 2.
Starting at Block 2, you can move between Block 2 and Block 1.
Hence, the maximum number of distinct that you can visit is 2 in this case.
``````
##### Input Format:
``````The first line of the input contains an integer, 'T,’ denoting the number of test cases.

The first line of each test case contains an integer, 'N,’ denoting the number of elements in the array 'ARR'

The second line of each test case contains 'N' space-separated integers denoting the elements of the array 'ARR'.
``````
##### Output Format:
``````For each test case, return the maximum number of distinct blocks that you can reach by starting from an arbitrary block.
``````
##### Note :
``````You do not need to print anything. It has already been taken care of. Just implement the given function.
``````
##### Constraints:
``````1 <= T <= 10
1 <= N <= 10^5
0 <= ARR[i] < N

All elements of the array ARR are pairwise distinct.

Time limit: 1 sec
``````