left(NULL), right(NULL) {}8* };9*/10classSolution {11public:12TreeNode *sortedArrayToBST(vector<int> &num,intstart,intend) {13if(start >end) {14returnNULL;15}16//if you write " int middle = start + (end - start) >
This is to test your knowledge on BST and its traversal. Flatting BST into an array using in-order, and check that array. It is that simple: classSolution {public:voidserial(TreeNode *root, vector<int> &vec) {if(!root)return;if(root->left) serial(root->left, vec); vec.push_back(...