You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello @tddevlin, it seems like you're talking about next_permutation.tsv. It is true that current tests are against the book definition of the problem. However, the presented algorithm seems to handle inputs with repetitions just well. I'll check on this with the book authors and either remove invalid tests or expand problem definition. Thank you
@tddevlin: thanks for pointing this out. We've reworded the problem to reflect that the ask is to generate the lexicographical successor of the array.
E.g., A = [1, 2, 3, 1], you should return [1, 3, 1, 2]; if the input is [2,2,4,1,3], you should return [2,2,4,3,1]. If there is no such array, e.g., the input is [3, 2, 1, 1], return the empty array.
The input is [4, 2, 2, 4, 2], which is not a valid permutation.
The text was updated successfully, but these errors were encountered: