Uber Interview Question

Code secret santa

Interview Answer

Anonymous

Jun 22, 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.