Company: Microsoft_data_scientist_role
Difficulty: medium
Visible Profiles Count Problem Description A popular social media platform provides a feature to connect people online. Connections between users are represented as an undirected graph, where each node represents a user, and edges represent connections between users. If a user is directly or indirectly connected to another user, they can view their profile. The network consists of nodes users numbered from 1 to nodes, and edges connections represented by two arrays, u and v. Each pair (u[i], v[i]) indicates a connection between users u[i] and v[i]. The queries array contains a list of user IDs. For each user ID in queries, determine the total number of users whose profiles are accessible to that user. Return an array of integers where the i-th value corresponds to the result for the i-th query. Examples Example 1: Input: nodes = 7, edges = 4, u = [1, 2, 3, 5], v = [2, 3, 4, 6], queries = [1, 3, 5, 7] Output: [4, 4, 2, 1] Explanation: The connections form the following components: - {1,