Complete the code to initialize the queue with the start node.
queue := []int[1]The BFS queue must start with the start node to begin traversal.
Complete the code to mark the start node as visited.
visited[start] = [1]Marking the start node as visited prevents revisiting it during BFS.
Fix the error in the BFS loop condition to continue while queue is not empty.
for len(queue) [1] 0 {
The BFS loop runs while the queue length is greater than zero.
Fill both blanks to correctly update distance and enqueue neighbors.
if !visited[neighbor] { visited[neighbor] = true distance[neighbor] = distance[current] [1] 1 queue = append(queue, [2]) }
Distance to neighbor is current distance plus one, and neighbor is added to queue.
Fill all three blanks to return the shortest path distance or -1 if unreachable.
if distance[target] == [1] { return [2] } return [3]
If distance[target] is 0 (unvisited except start), return -1 for unreachable; else return distance.
