McKinsey & Company Interview Question

They asked me solve an advanced algorithmic puzzle