Like most problems, I recommend solving this by hand and pay attention to the information you keep track of to solve it. Here you need to recognize how to get a sorted array from a binary search tree.
Some results have been hidden because they may be inaccessible to you
Show inaccessible results