Sponsored
Use these hints if you're stuck. Try solving on your own first.
Which type of traversal lets you find the distance from a point?
Try using a Breadth First Search.
Solve with full IDE support and test cases