Wednesday, September 22, 2010

Find next larger number

Given: a number containing N decimal digits (N can be very large), represented as a string. Problem: find the permutation of this string that represents the first number that is bigger than the given one, or return null if such number does not exist. Example: 279,134,399,742 -> 279,134,423,799

No comments:

Post a Comment