Solved LeetCode program · 667 of 1,000
#0897 · Increasing Order Search Tree
Original English source
Keep a shared values as an empty list of whole numbers. Keep a shared lefts as an empty list of whole numbers. Keep a shared rights as an empty list of whole numbers. Keep a shared order as an empty list of whole numbers. Place 5 into values. Place 3 into values. Place 6 into values. Place 2 into values. Place 4 into values. Place 8 into values. Place 1 into values. Place 7 into values. Place 9 into values. Place 1 into lefts. Place 3 into lefts. Place -1 into lefts. Place 6 into lefts. Place -1 into lefts. Place 7 into lefts. Place -1 into lefts. Place -1 into lefts. Place -1 into lefts. Place 2 into rights. Place 4 into rights. Place 5 into rights. Place -1 into rights. Place -1 into rights. Place 8 into rights. Place -1 into rights. Place -1 into rights. Place -1 into rights.
To gather from node (a whole number). If node is less than 0, return. Gather from item node of lefts. Place item node of values into order. Gather from item node of rights.
Gather from 0. The last is the last position of order. The final is item last of order. The pieces is an empty list of text.
For each value in order.
The piece is format whole number value as text. Place piece into pieces. If value is not final, Place "null" into pieces.
The line is join pieces with ",". Show line.
Expected stdout
1,null,2,null,3,null,4,null,5,null,6,null,7,null,8,null,9