I would like an algorithm that goes through a 2D array and guarantees that each column has all distinct numbers. If a dupe is found in the array it should be replaced with a random number. The random number must also preserve the uniqueness.
If we put a random number, the whole column, should be unique.
is it possible to get an O(N) solution too ?