Last active
June 17, 2016 15:55
-
-
Save varlal/0b2b1cbf937b4780bc4bc05b7723db48 to your computer and use it in GitHub Desktop.
ある数字の文字numが与えられた時,一度だけ一文字を交換できる.ただし,先頭に0は来ない. この時,値が最小になるように文字を交換せよ.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0) | |
“596” | |
Returns: “569” | |
You can swap num[1] and num[2] to get the minimum integer. | |
1) | |
“93561” | |
Returns: “13569” | |
2) | |
“5491727514” | |
Returns: “1491727554” | |
3) | |
“10234” | |
Returns: “10234” | |
You can leave the original String num unchanged. | |
Note that the result must not contain leading zeros. | |
4) | |
“93218910471211292416” | |
Returns: “13218910471211292496” |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment