Company: Salesforce_29july

Difficulty: easy

Problem Statement

A popular social media platform provides a feature that connects people online. Connections between users are represented as an undirected graph , where each node represents a user and each edge represents a connection between two users. If a user is directly or indirectly connected to another user, that user can view their profile. Every user can also view their own profile. The network consists of nodes users numbered from 1 to nodes , and edges connections. For each user id in the query list, determine the total number of users whose profiles are accessible to that user (including the user themselves). Input Format Read from standard input: The first line contains two space-separated integers nodes and edges . Each of the next edges lines contains two space-separated integers u and v , denoting a connection between users u and v . The next line contains a single integer q , the number of queries. Each of the next q lines contains a single integer, a user id to query. Output Format P

More Salesforce_29july OA questionsInterview experiences