Interview Query

Rearranging Digits

Start Timer

0:00:00

Upvote
1
Downvote
Save question
Mark as completed
View comments (5)
Next question

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'
.
.
.
.
.


Comments

Loading comments