Pergunta de entrevista da empresa Baidu

Sort an array so that all odd numbers stay before the even ones. Solve in O(n).