Order of output is rejecting the solution

For A : [ 12, 13 ]

Your function returned the following :
[12 13 ] [12 ] [13 ] []
The expected returned value :
[] [12 ] [12 13 ] [13 ]

Only ordering is different, both are actually same. Still its rejecting solution.

Same here. Any solution you got?

you have to return the answer arranged in ascending order. It is mentioned in the question.

Just sort the result vector. No custom comparator fn needed.

Click here to start solving coding interview questions