Often, LeetCode problems require a slight learning curve to feel comfortable using their TreeNode data structure. One helpful portion of the LeetCode website describes a detailed example. Have a look at the linked content here
The goal of this product is to provide a library that will return a TreeNode object that can be traversed visually. Such an example is shown among the FAQ's on the Leetcode website. in short, this library which is on PIP aims to provide a visual much like this
To install, use pip and the command land as follows:
pip install viztraverse
Once installed you can import the library as follows:
import viztraverse from viztraverse
Then to use the serialize library:
viztraverse.deserialize([1,1,null,1]);
And, finally to draw:
viztraverse.draw(viztraverse.deserialize([1,1,null,1]);
In order to draw, the turtle library is imported. Among potential problems include MacOS users recievving an error regarding a tkanner mooduel not found. The fix is quite straight forward with brew. For more information you can visit this link. Though, entering the following command will likely solve the problem.
brew install python-tk@3.9
More than willing to work with folks who want to add features. No immediate goals but for a set of tests. If you have ideas you can include them in your Pull Requests.
A Leet Code user named StefanPochmann wrote the entire code. You can view the original post here. For my part, I simply took the necessary steps to put it online.