Skip to content

Instantly share code, notes, and snippets.

@varlal
Last active June 17, 2016 15:55
Show Gist options
  • Save varlal/0b2b1cbf937b4780bc4bc05b7723db48 to your computer and use it in GitHub Desktop.
Save varlal/0b2b1cbf937b4780bc4bc05b7723db48 to your computer and use it in GitHub Desktop.
ある数字の文字numが与えられた時,一度だけ一文字を交換できる.ただし,先頭に0は来ない. この時,値が最小になるように文字を交換せよ.
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