Pergunta de entrevista da empresa Microsoft

Write a function to reverse an integer (i.e. 123 = 321), with O(1) space complexity.