Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Line 17 in permutation.tsv is not a permutation #57

Closed
tddevlin opened this issue Sep 25, 2018 · 4 comments
Closed

Line 17 in permutation.tsv is not a permutation #57

tddevlin opened this issue Sep 25, 2018 · 4 comments
Assignees
Labels
problem definition issue Judge tests don't match book definition of the problem
Milestone

Comments

@tddevlin
Copy link

The input is [4, 2, 2, 4, 2], which is not a valid permutation.

@tddevlin
Copy link
Author

In fact there are many invalid permutations in this test file.

@metopa
Copy link
Collaborator

metopa commented Jan 8, 2019

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

@metopa metopa added the problem definition issue Judge tests don't match book definition of the problem label Jan 8, 2019
@metopa metopa added this to the Beta 5 milestone Aug 19, 2019
@adnanaziz
Copy link
Owner

@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.

@adnanaziz
Copy link
Owner

Closed with update to book and response to @tddevlin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
problem definition issue Judge tests don't match book definition of the problem
Projects
None yet
Development

No branches or pull requests

3 participants