Today, I revisited an old problem that I wasn't able to complete before. This time I did really well. It was an insanely hard problem, but I did 80% of it. I think that if my python skills were a little better, I would have come really close to completing it. The problem was constructing binary trees with a list of its inorder traversed elements and preorder traversed elements. Something that I learned today was the keyword nonlocal in python. It allows an inner function to refer to a variable referenced by the outer function.
Here is my code.
No comments:
Post a Comment