Introduction
It is the algorithm my coach gave to me on mock interview June 1, 8:00 AM. I like the conversation we had and then I had some conversation with the coach. My idea is that there are so many ways to solve the problem.
After I solved the algorithm, the coach asked me to write the solution of preorder traversal of tree using iterative solution. And then he told me that the solution to write iterative way for flatten a list is the same idea.
The coach helped me to clear up the confusion of preorder traversal. The order is always defined from the root node's position.
Mock interview
Here is mock interview transcript.
Here is the code I wrote for preorder traversal iterative solution.
Follow up
June 3, 2018
No comments:
Post a Comment