for the preorder array [10,5,7], we may construct a tree like

```
10 10
/ \ or /
5 7 5
\
7
```

the first one is an invalid bst, but the second one is valid, how to solve it?