Question: You are given a number n which denotes the number of students in a class. You are given Q queries and two arrays student 1
You are given a number n which denotes the number of students in a class. You are given Q
queries and two arrays student and student of size Q each. A query can be of types
FriendTotal If the query is Friend then make studentq and studentq each others
friends. q refers to the serial number of the query, ie the index in the queries array. If the
query is of type Total then return the total number of the students in the group of
studentq and studentq They both might be in the same group, so you do not need to
count twice in that case
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
