Interview Query

Rearranging Digits

0
Have you seen this question before?

Given a string n, a multi-digit number, write a function rearranging_digits to return a string of the smallest number larger than n that can be created by rearranging the digits in n. Return None if no such number exists.

Example:

Input:

n = '395'

Output:

def rearranging_digits(n) -> '539'
Next question: Inception Architecture
.....
Python 3.9.6
Loading editor
Use Shift + Enter to run code