Skip to main content
DevHives

Repair a BST With Two Swapped Values

Loading editor…

3 examples run when you press Run. Submit checks every hidden test too.

Case 1
Input:
[8,12,3,1,5,10,14]
Expected:
[8,3,12,1,5,10,14]
Case 2
Input:
[15,10,30,null,20]
Expected:
[20,10,30,null,15]
Case 3
Input:
[-7,-4]
Expected:
[-4,-7]
Ready

Run checks your code against the 3 examples. Submit checks it against all 113 tests and needs a free account. You can also try ideas in the free JavaScript or Python compiler.