Sponsored
Sponsored
Use these hints if you're stuck. Try solving on your own first.
It can be proven that all pairs should be asked from the helper function.
Iterate from the first element. For each element `i`, ask the helper function `i` with all `j < i`.
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.