@StefanPochmann Could you help me with this ?

Anyone who can help me with it ?

Please refer to the screenshot below:

I got confused, anything wrong with my output here ?? Why the expected answer is "-1" ???

It doesn`t make sense to me.

My code is attached as below:

```
class Solution(object):
def nextGreaterElement(self, n):
"""
:type n: int
:rtype: int
"""
if len(str(n))<2:
return -1
a = list(str(n))
for i in xrange(1,len(a)):
if a[-i]>a[-i-1]:
b = a[-i:]
b.sort()
a[-i:] = b
for j in xrange(-i,0,1):
if a[j]>a[-i-1]:
a[j],a[-i-1] = a[-i-1],a[j]
return int("".join(a))
return -1
```