Company: Oracle
Difficulty: medium
Valid BST Permutations Problem Description A binary tree is a data structure characterized by the following properties: It can be an empty tree where root = null. It can consist of a root node that contains a value and two sub-trees labeled "left" and "right". Each sub-tree also follows the definition of a binary tree. A binary tree is a binary search tree (BST) if all the non-empty nodes follow these two rules: If a node has a left sub-tree, then all the values in its left sub-tree are smaller than its value. If a node has a right sub-tree, then all the values in its right sub-tree are greater than its value. Given an integer, determine the number of valid BSTs that can be created by nodes numbered from 1 to that integer. Please see the samples below for diagrams based on 1, 2 or 3 nodes. Function Description Complete the function `numBST` in the editor below. `numBST` has the following parameter(s): `int nodeValues[n]`: an array of integers, where `nodeValues[i]` is the number of nod