2782. Number of Unique Categories
Union-FindInteractiveCounting
Hints
Hint 1
It can be proven that all pairs should be asked from the helper function.
Hint 2
Iterate from the first element. For each element `i`, ask the helper function `i` with all `j < i`.
Hint 3
If there is some `j < i` that `i` and `j` belong to the same group, go to next `i`. Otherwise, add one to the current number of groups.
Preparing judge…