← All problemsSign in

Visit the cities

Bob has got a new car. He would love to take his girlfriend for a long drive. There are N cities and N-1 bi-directional roads in the state and there is at most one way to move between each pair of cities. His girlfriend wants to take the longest drive. She wants to cross as many cities possible during the drive such that no city is crossed more than once. Can you tell the maximum number of citie

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.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start