Skip to main content
1 of 3
herby
  • 2.8k
  • 1
  • 20
  • 25

This is a tree, Dijkstra is O(n^2) overkill. Trivial O(n) breadth-first search is enough.

herby
  • 2.8k
  • 1
  • 20
  • 25