# Did I meet a bug of leetcode system???

• Re: Why this answer is wrong?
Did I meet a bug of leetcode system?please help me!
class Solution(object):
def reverse(self, x):
"""
:type x: int
:rtype: int
"""
f = 0

``````    if x<0:
x=-x
f = 1
if f==0 and x>1000000003:
return 0
if f==1 and x>1000000003:
return -x

l = len(str(x))
x = str(x)
y =''

for i in xrange(l):
y =  x[i] + y

y = int(y)
if f==1:
y = -y
return y
``````

But the system said:
Input: -2147483412
Output: -2147483412
Expected: -2143847412

It's amazing !!Why???

``````    if f==1:
y = -y
return y``````

• Why the expected number is a little different from the input number?
I think it should be 0 or as same as the input number
But...it just changed 3 numbers!
the system wrong?

• How is -2143847412 not obviously the correct answer?

• @ManuelP Well,I want to ask why the reversing is not successful.It should not be as the same as the input number

• @zaixiahanli Your code outputs the input because you pretty much explicitly tell it to. With your `if f==1 and x>1000000003: return -x`. Did you forget and overlook that part?

Looks like your connection to LeetCode Discuss was lost, please wait while we try to reconnect.