mirror of
https://github.com/donnemartin/interactive-coding-challenges.git
synced 2024-03-22 13:11:13 +08:00
Simplified check to determine if there are items in the queue.
This commit is contained in:
parent
bad87c9f87
commit
370ceaf414
|
@ -117,7 +117,7 @@
|
||||||
" queue = deque()\n",
|
" queue = deque()\n",
|
||||||
" queue.append(root)\n",
|
" queue.append(root)\n",
|
||||||
" root.visited = True\n",
|
" root.visited = True\n",
|
||||||
" while len(queue) > 0:\n",
|
" while queue:\n",
|
||||||
" node = queue.popleft()\n",
|
" node = queue.popleft()\n",
|
||||||
" visit_func(node.id)\n",
|
" visit_func(node.id)\n",
|
||||||
" for adjacent_node in node.adjacent:\n",
|
" for adjacent_node in node.adjacent:\n",
|
||||||
|
|
Loading…
Reference in New Issue
Block a user