This is a verified interview question from Cisco. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Optimal Seed Selection" covers key patterns like Other.
"### Problem Given a network of users and their connections, costs, and values, select a set of seeds that maximizes the total market value while staying within a given budget. ### Input - connections: A list of tuples representing connections between users. - costs: A dictionary mapping user IDs to their costs. - values: A dictionary mapping user IDs to their values. - budget: The maximum budget for selecting seeds. - d: The depth of the network. ### Output A tuple or structure containing three elements: 1. A list of the integer user IDs chosen as seeds, in the order they were selected. 2. The total market value reached by this set of seeds. 3. The total cost of the chosen seeds. ### Example 1: The High-Efficiency Choice **Input:** - connections: [[1, 2], [1, 3], [4, 5]] - costs: {1: 50, 2: 20, 3: 20, 4: 60, 5: 20} - values: {1: 10, 2: 20, 3: 30, 4: 5, 5: 5} - budget: 100 - d: 1 **Output:** - Chosen Seeds: [1] - Total Value: 60 - Total Cost: 50"
Join thousands of developers practicing for Cisco.