Sort 35 Discussions, By:
Please Login in order to post a comment
Oh man, I've spend few hours on this problem even though I had idea how to solve it after 10-15 minutes...
Those corner cases killed me... :)
[OPINION] Some of the problems on Hackerrank are not for cracking the coding interview or teaching you a cool new way of thinking but rather for testing your patience and corner case engineering abilities. This is one of those problems. The return of investment in that kind of problems is very low. At least the author could make the special cases in inputs more obvious by making them concise to save us some debugging time.
Is all the cases right?
If the num is 110, then the next number should be 1001.
In TC#8, the case is
Which represents 110.
The next number with the same set-count is 1001, which is represented as
1 2 1.
But the expected output is 1 3 1.
Am I understanding this correctly?
Excuse me, but how am I gonna handle input values up to 10^18 if I'm given a vector of ints as a function input? I'll have to modify the code outside the target function to replace all the ints with **int64_t**s.
A ridiculous way to define a problem.