โ† ServiceNow questions

City traversal by distance

Filed under ServiceNow

Given a graph of cities and bidirectional roads, print the cities in order of their shortest distance from a source city. For cities at the same distance, visit them in ascending numerical order.

You've read your 3 free write-ups

Sign up free to keep reading. Your account opens the first 10 questions of every company.

Related ServiceNow questions

Collected from public candidate posts and coding forums. Updated Nov 2026.