We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
I have no clue in whos vocab is this a Basic - Easy questions. This is more like a medium question and I would say a harder one of that.
I have used a backtracking kind approach.
Try diff length numbers to begin the recursive calls, then check if the next number we can come up with is +1 of previous.
If we find a number like that we have another recursive call.|
If the number is too big we can stop and return false.
If the starting number size is already more than half the digits count we can also stop.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Separate the Numbers
You are viewing a single comment's thread. Return to all comments →
I have no clue in whos vocab is this a Basic - Easy questions. This is more like a medium question and I would say a harder one of that.
I have used a backtracking kind approach. Try diff length numbers to begin the recursive calls, then check if the next number we can come up with is +1 of previous. If we find a number like that we have another recursive call.| If the number is too big we can stop and return false. If the starting number size is already more than half the digits count we can also stop.