7. Reverse Integer

題目: 解答: 簡單的數字轉換 代碼: class Solution { public: int reverse(int x) { int ans = 0,flag = x >= 0 ? 1 : -1; x = flag * x; while( x ) { ans = 10 * ans + x % 10;
相關文章
相關標籤/搜索