3. Given the following Rust code snippet, what will be the output?
struct TreeNode {
val: i32,
left: Option,
right: Option,
}
fn is_bst(node: &Option, min: Option<i32>, max: Option<i32>) -> bool {
match node {
None => true,
Some(n) => {
if let Some(min_val) = min {
if n.val <= min_val { return false; }
}
if let Some(max_val) = max {
if n.val >= max_val { return false; }
}
is_bst(&n.left, min, Some(n.val)) && is_bst(&n.right, Some(n.val), max)
}
}
}
fn main() {
let root = Some(Box::new(TreeNode {
val: 10,
left: Some(Box::new(TreeNode { val: 5, left: None, right: None })),
right: Some(Box::new(TreeNode { val: 15, left: None, right: None })),
}));
println!("{}", is_bst(&root, None, None));
}