two sum (1) 썸네일형 리스트형 [LeetCode] Reverse Integer | 난이도: Easy 문제 Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [−2³¹, 2³¹ − 1], then return 0. 주어진 32비트 정수 x값이 있다. 정수 x 자릿수를 역으로 바꾸어라.만약 역으로 바꾼 정수의 값의 범위가 −2³¹, 2³¹ − 1를 넘어갔을 경우, 0을 반환한다. 예시 Input: x = 123 Output: 321 말 그대로 숫자를 반대로 뒤집는 것. 답안 class Solution { public int reverse(int x) { long res = 0; while(x != .. 이전 1 다음