A binary tree is a data structure characterized by the following properties:
A binary tree is a binary search tree (BST) if all the non-empty nodes follow these two rules:
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.
Complete the function numBST in the editor below.
numBST has the following parameter(s): int nodeValues[n]: the number of node values to analyze
Returns: int[n]:the number of different binary search trees that can be created for each test case modulo 1000000007(10^9 + 7).
Sample Input STDIN Function 5 nodeValues[] size n = 5 nodeValues = [1, 2, 3, 4, 100]
The function returns an array of integers, each representing the number of unique BSTs for the corresponding input value modulo 1000000007.