Accepted solution for reversing integer