summaryrefslogtreecommitdiff
path: root/progs/unparsable_programs/a770.py
blob: 01aa0da8fb5db7e8843833158ec48898eb5c64e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
def rearrange_bigger(n):
    nums = list(str(n))
    for i in range(len(nums)-2,-1,-1):
        if nums[i] < nums[i+1]:
            z = nums[i:]
            y = min(filter(lambda x: x > z[0], z))
            z.remove(y)
            z.sort()
            nums[i:] = [y] + z
            return int("".join(nums))
    return False