You are given the root of a binary search tree (BST), where the values of exactly two nodes of the tree were swapped by mistake. Recover the tree without changing its structure.
- The
rootof a distorted BST.
Input: root = [1, 3, null, null, 2]
Output: [3, 1, null, null, 2]
Explanation: Nodes 1 and 3 were swapped.