summaryrefslogtreecommitdiff
path: root/progs/unparsable_programs/a770.py
diff options
context:
space:
mode:
Diffstat (limited to 'progs/unparsable_programs/a770.py')
-rw-r--r--progs/unparsable_programs/a770.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/progs/unparsable_programs/a770.py b/progs/unparsable_programs/a770.py
new file mode 100644
index 0000000..01aa0da
--- /dev/null
+++ b/progs/unparsable_programs/a770.py
@@ -0,0 +1,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 \ No newline at end of file