I know how to find the brute force solution, but I need a bettertime. Any help would be nice. Thanks!

9. A pair of nodes r, y in a (supposed) binary search tree violate the BST property if is an ancestor of y, and the corresponding values are “out of order”. Given a BST,
PayPal Gateway not configured
PayPal Gateway not configured