We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
package main.java.com.poogle.LeetCode.Q7; public class Solution { public int reverse(int x) { if (x > Integer.MAX_VALUE || x < Integer.MIN_VALUE) return 0; int result = 0; int cnt = 0; while (x != 0) { cnt++; result = result * 10 + x % 10; x /= 10; if (cnt == 9 && x != 0) { int cmp = Integer.MAX_VALUE / 10; if (result > 0) { if ((result - cmp) > 0) { result = 0; break; } } else { if ((result + cmp) < 0) { result = 0; break; } } } } return result; } }
The text was updated successfully, but these errors were encountered:
ababc25
suhyunsim
No branches or pull requests
문제
핵심 아이디어
어려운 점, 실수
-> 9자리일 때를 고려하지 못함
풀이
The text was updated successfully, but these errors were encountered: