Ashoka the Marketeer
CodeChefOpen on judge ↗
Ashoka wants to spread Dhamma and is trying to increase his reach. You have been given an undirected graph with $n$ nodes and $m$ edges. Each node represents a city and each edge represents a road between two cities. Pataliputra is the node with index 1. Find out the minimum number of roads that need to be built so that all the cities are reachable from Pataliputra. ###Input: - First line
HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17
CodeSearch Tutor
Hints, not spoilers — it won’t hand over the full solution unless you insist.
Sign in to chat with the tutor and save your progress.
Sign in to start