Find the missing number in a string of numbers with no separator | Solution Needed
Anonymous User
2300

Find the missing number in a string of numbers with no separator

Given a string consisting of some numbers, not separated by any separator. The numbers are positive integers and the sequence increases by one at each number except the missing number. The task is to find the missing number. The numbers will have no more than six digits. Print -1 if the input sequence is not valid.

Examples:

Input : 89101113
Output : 12

Input : 9899101102
Output : 100

Input : 596597598600601602:
Output : 599

Input : 909192939495969798100101
Output : 99

Input : 11111211311411511
Output : -1

Can anyone share the solution or logic for this problems ??! I get stuck when number increases from 9 to 10 or 99 to 100 ??

Comments (7)