Uber interview question

Code secret santa

Interview Answer

Anonymous

22 Jun 2016

Gist: Insert all the names in a vector. Use Fisher-Yates algo to shuffle the vector randomly in O(N) time. Now that the array is shuffles, for each i, (i-1)%n becomes it's secret Santa.