Loading collection data...
Collections are a way for you to organize kata so that you can create your own training routines. Every collection you create is public and automatically sharable with other warriors. After you have added a few kata to a collection you and others can train on the kata contained within the collection.
Get started now by creating a new collection.
Your code being too slow is not a suggestion.
This comment has been deleted.
Timed OutPassed: 10Failed: ?Exit Code: 1
Test Results:
Log
['Liquor', 'Vodka', 'Mint', 'Pineapple', 'Watermelon']
Basic tests
Simple tests
(5 of 5 Assertions)
Impossible cocktails
(2 of 2 Assertions)
Not enough ingredients
(2 of 2 Assertions)
Ice: taste = 0
Completed in 9.37ms
Performance tests
26^2 ingredients (5 datasets)
STDERR
Execution Timed Out (12000 ms)
Why did my code time out?
Our servers are configured to only allow a certain amount of time for your code to execute. In rare cases the server may be taking on too much work and simply wasn't able to run your code efficiently enough. Most of the time though this issue is caused by inefficient algorithms. If you see this error multiple times you should try to optimize your code further.
Do you think I should raise it to 3kyu?
I do think we underestimated the difficulty level of this kata. I don't think anyone has solved this kata yet after approval.
I think it's best if I remove it then.
Yeah, that's really weird. I tried running your solution and I couldn't get the print statements to work (except for the first one, for some reason. If I remove it, nothing is printed at all). I read the test cases and found nothing that may prevent a print statement from executing... not sure what's up.
I don't think so. A proper solution never times out.
Yeah, clearly I have to make it more efficient (seems I overestimated the power of generators)
The entire dictionary does print though, but not the int parameters. That's what struck me as weird
Is the footnote about resubmitting on timeout still relevant?
True, it's quite strange... if I were to take a guess, I would assume this is a symptome of trying to print a dict of this size: while it's useful to see the example tests' ingredients to find the cause of any bugs, it's pretty much pointless on the performance tests, because there's too many ingredients to check.
Actually, it's straight up counterproductive because print statements impact your performance: if I were you, I would remove print statements when I'm going for the submission rather than the example test cases. As stipulated in the kata description, example test cases should be enough to confirm your algorithm is correct, so you shouldn't need to "debug" performance tests.
Oh, you meant the
print("goal flavour: ", flav)
. I thought you are talking aboutprint(results_list)
.You're right, that's pretty weird.
Why would that prevent the second print statement from executing though when it comes before the generator expression
The second print there doesn't execute because there are
26^2
ingredients.With that amount of ingredients, currently your code is checking this many possibilities:
Of course, checking all 1 trillion possibilities would be very slow.
Loading more items...