Nutanix SWE OA (2023) | Binary Search Tree Validation and Tree Recovery Interview Question

Question · Posted Jun 2026

Q1. Recover Binary Search Tree Problem Statement You are given the root of a Binary Search Tree (BST), where exactly two nodes have been swapped by mistake. Restore the BST without changing its structure. The solution should modify only the incorrect node values and recover the original BST. Example 1 Input       1      /     3      \       2 Output       3      /     1   ...

The full answer & interview discussion are available to premium members.

Log in Create a free account