From The Compiler, 9 Years ago, written in Python.
Embed
  1. def iterativeChildren(nodes):
  2.         results = []
  3.         while True:
  4.                 newNodes = []
  5.                 if not nodes:
  6.                         break
  7.                 for node in nodes:
  8.                         results.append(node['id'])
  9.                         newNodes += node['children']
  10.                 nodes = newNodes
  11.         return results

Replies to Untitled rss

Title Name Language When
Re: Untitled anonymous ruby 1 Year ago.
Re: Untitled anonymous python 5 Years ago.