Solution: Find the Corrupt Pair
Understand how to apply cyclic sort to find a missing and duplicated number pair in an unsorted array. This lesson teaches you to rearrange elements by their correct positions and detect the corrupt pair in linear time with constant space.
We'll cover the following...
We'll cover the following...
Statement
We are given an unsorted array, nums, with elements and each element is in the range inclusive. The array originally contained all the elements from to but due to a data error, one of the numbers is duplicated, which causes another number missing. Find and return the corrupt ...