Groupon interview question

Write an algorithm. Twice.