Solved LeetCode program · 133 of 1,000
#0133 · Clone Graph
Original English source
Keep a shared edges holding 1, 3, 0, 2, 1, 3, 0, and 2. Keep a shared starts holding 0, 2, 4, and 6. Keep a shared counts holding 2, 2, 2, and 2. Keep a shared copyedges as an empty list of whole numbers. Keep a shared copystarts as an empty list of whole numbers. Keep a shared copycounts as an empty list of whole numbers.
For each edge in edges.
Place edge into copyedges.
For each start in starts.
Place start into copystarts.
For each count in counts.
Place count into copycounts.
Keep a shared line as empty text.
To list from node (a whole number) with spot (a whole number). If spot is more than item node of copycounts, return. If spot is more than 0, Place " " into line. The base is item node of copystarts. The target is item (base plus spot minus 1) of copyedges. Place format whole number target plus 1 as text into line. List from node with spot plus 1.
For every node from 0 to 3.
Set line to format whole number node plus 1 as text. List from node with 1. Show line.
Expected stdout
1 2 4 2 1 3 3 2 4 4 1 3