Posts

Showing posts with the label quiz

TCS CODEVITA old Questions

Problem : Online Communities - Even Groups-2014 In a social network, online communities refer to the group of people with an interest towards the same topic. People connect with each other in a social network. A connection between Person  I  and Person  J  is represented as  C I J . When two persons belonging to different communities connect, the net effect is merger of both communities which I and J belonged to. We are only interested in finding out the communities with the member count being an even number. Your task is to find out those communities. Input Format: Input will consist of three parts, viz. 1. The total number of people on the social network  (N) 2.Queries  C I J , connect I and J Q 0 0 , print the number of communities with even member-count -1 will represent end of input. Output Format: For each query Q, output the number of communities with even member-count Constraints: 1<=N<=10^6 1<=I, J...