Tuesday, June 9, 2015

Leetcode: zigzag order traversal of binary tree

One more C# practice on level order traversal. So excited to read my past practice in 2015, April 29. Cheers! 

April 29, 2015 

I Spent a few hours to study the question. The website I read:
One thing I do not like is to use two while loop, and since it makes me wonder how to make it more simple and readable.
This is a better solution, I like it more:
Here is C# code I write and test on April 29, 2015:
https://github.com/jianminchen/zigzagOrderTraversal/blob/master/Program.cs


Follow up 


May 3, 2018

I spent over 30 minutes to review the C# code writting in 2015. I am not happy about the coding style, and also the code is not easy to read. I need to debug the code, and then update readable variable names, and understand how to apply stack to store nodes for each level.


Here is the C# code I ran and passed all test cases.





No comments:

Post a Comment