Pergunta de entrevista da empresa Oracle

A question about Cards puzzle.