Question d’entretien chez Clearwater Analytics (CWAN)

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

Réponse à la question d'entretien

Utilisateur anonyme

30 août 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