static auto io_sync_off = [](){ std::ios::sync_with_stdio(false); std::cin.tie(nullptr); return nullptr; }(); class Solution { public: int reverse(int x) { long result = 0; while (x != 0) { // cout << result*10 << "; "<<x%10<<endl; result = result * 10 + x % 10; if (result > INT_MAX || result < INT_MIN) return 0; x /= 10; } return result; } };