Pergunta de entrevista da empresa Microsoft

I did not get any particularly challenging algorithms/data structures questions, but one problem had a constant-time solution that was not immediately obvious. So before jumping in think whether there could be a trick that trivializes the problem.