Validate binary search tree
Your task
Given a binary tree as a level-order array (null for missing), determine whether it is a valid binary search tree: every node's value is strictly greater than all values in its left subtree and strictly less than all values in its right subtree. Duplicate values make it invalid. Return true or false.
Examples
is_valid_bst(level: list) -> boolExample 1
Input
is_valid_bst([2, 1, 3])Output
True