Pergunta de entrevista da empresa Clearwater Analytics (CWAN)

How do reverse a number (like 1284 to 4821) without resorting to string manipulation?

Resposta da entrevista

Sigiloso

30 de ago. de 2017

int x, y; y = 1284; while (0 != (x = mod y by 10)) { stack,push(x) y /= 10 } x = 0; while (null != (y = stack.pop())) x = (x *10) + y x == 4821