On 06/14/2012 06:08 PM, mogwai84 wrote:
Hi all,

I've got a very long numeric string. I want to find the lowest number that
isn't in that string.

E.G

String = 123456
Therefore 7 is the lowest number not in that string

E.G.2

String = 1234567891011
Therefore 13 is the lowest number not in that string.

Any thoughts? p.s. I'm an R noob.

Hi mogwai84,
Your second example is inconsistent with the first. If the answer is not 12, then you must be counting the first two digits as a pair. However, that can't be right, because there are several other pairs that are much larger than 13. Are you making the assumption that all strings of digits contain monotonically increasing integers? Without a better specification of the problem, one can only guess at a solution.

Jim

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to