KevinDeBruyne17's blog

By KevinDeBruyne17, history, 3 months ago, In English

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

Read more »

 
 
 
 
  • Vote: I like it
  • 0
  • Vote: I do not like it