← 返回 ibm 的题目列表Maximize Integer with Swap
类型:online_judge
ibm
Given an integer, perform at most two adjacent swaps to create the largest possible number.
Input
number: the integer in string format.
Output
Return the largest integer that can be created by performing at most two adjacent swaps.
Example
Input: number = '96518' Output: 98516
Explanation: Swap 5 and 8 to obtain the maximum possible value.
Example
Input
'96518'