Algorithm · Uber · Medium
Build a pair of routines for an N-ary tree: one that turns the tree into a string, and one that rebuilds the tree from that string. A round trip through both must reproduce every node value, the exact shape of the tree, and the original ordering of each node's children. The source post leaves the encoding unspecified, so the interface and limits below are provided as a practice formulation. Node representation. Each node is written as {"val": integer, "children": [child…