### KevinDeBruyne17's blog

By KevinDeBruyne17, history, 7 weeks ago,

Statement: Given a vector of ranges of the form [L,R] (L,R > 0). We have to print all unique integers that can be formed by concatenating integers taking one at a time from each of such ranges.

Constraints: Size of vector of ranges ~ 100

R - L <= 1000

Sample Example: Given vector: <[2,4], [3,5]>

Output: 23,24,25,33,34,35,43,44,45

This was one of the question that I was asked in an interview. I could only give a recursion based approach to this, where I checked for every integer in every range. Can someone help me with a more optimised approach for this

• 0

 » 7 weeks ago, # |   +3 In your first statement, you are talking about integers while, in the end, it says "digits". Which one is correct?
•  » » 7 weeks ago, # ^ |   0 Thanks, corrected the statement
 » 7 weeks ago, # |   0 Auto comment: topic has been updated by KevinDeBruyne17 (previous revision, new revision, compare).
 » 7 weeks ago, # |   +16 Is this problem really solvable? A valid input is {[100, 999], [100, 999], ..., [100, 999]} for 100 intervals which has an absurd number of answers that can't be printed in any reasonable amount of time.