We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
Day 23: BST Level-Order Traversal
Day 23: BST Level-Order Traversal
Sort by
recency
|
430 Discussions
|
Please Login in order to post a comment
python 3 solution
Since we can't use Python's collections.deque and the O(1) popleft function, it's actually more effecient to just maintain a pointer to your current location in the list (this avoids the O(N) cost of each pop(0) call).
Python 3:
JavaSCript
in JS