Skip to content

Latest commit

 

History

History
12 lines (9 loc) · 425 Bytes

File metadata and controls

12 lines (9 loc) · 425 Bytes

Problem 20: Sorting Discordance (BST)

Problem Statement

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.

Input Format

  • The root of a distorted BST.

Example

Input: root = [1, 3, null, null, 2]
Output: [3, 1, null, null, 2] Explanation: Nodes 1 and 3 were swapped.