Your question is Find Maximum in BST. Start with the requirements on the right.
Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.
In a Publicis Sapient interview setting, implement a function that returns the maximum value stored in a binary search tree (BST). Use the BST property to solve the problem efficiently instead of scanning every node.
A BST is defined such that for every node, values in the left subtree are smaller and values in the right subtree are larger. Because of this property, the maximum value is always found at the rightmost node.
root, the root node of a binary search tree, or None for an empty treeNone if the tree is emptydef find_max_bst(root):