Algorithm Atlas

Preparing your learning space

Checking your account, lessons, and saved progress. The server is starting after a long break. This first cold start may take 5–10 seconds

Find the City With the Smallest Number of Neighbors at a Threshold Distance: step-by-step visual explanation

Learn the Find the City With the Smallest Number of Neighbors at a Threshold Distance problem with a step-by-step DSA animation. Follow the Bellman-Ford solution with synced C#, Python, and Java code.

Bellman-Ford pattern

After V−1 passes every simple shortest path is represented. A further improvement proves a negative cycle.

Difficulty: Medium · Approach: Visible frontier and visited order

This is a public lesson preview. Sign in with a Lifetime Pass to open the protected animation, solution, and code.

More Bellman-Ford lessons