Loading Company...
This is a verified interview question from Amazon-ml-summer-school. Candidates reporting seeing this problem in recent Online Assessments (OAs) and onsite rounds. Mastering "Recover Binary Search Tree - AMAZON ML SUMMER SCHOOL" covers key patterns like Trees.
"Two elements of a Binary Search Tree (BST), represented by root A are swapped by mistake. Tell us the 2 values, when swapped, will restore the Binary Search Tree (BST). A solution using O(n) space is pretty straightforward. Could you devise a constant space solution? Note: The 2 values must be returned in ascending order"
Join thousands of developers practicing for Amazon-ml-summer-school.