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.
I also find it a little bit easier than expected. But it's natural, not every programmer at a specific level have the same range of skills.
For instance, some of the 5 kyu katas look like 3 kyu katas for me. It's amazing how the site work it out, but it's really impossible to uniform a one-dimentional rank for all warriors.
Find two typos:
Ah, sorry i didn't see that. I changed the assertion message to something more appropiate.
Thanks :) Done
I suggest add the tag "Optimization" for this Kata, since a lot of us look at first a little puzzled about why Kata Test Cases timeouted.
Also, I believe would help if a sample test include a big case, only to hint users of the obvious optimization issue.
I think it would help clarify the questions that many (as myself) seen to keep asking, without give to much away.
This is a great kata!
Thank you, falco. I should read it more carefully.
The issue is merely at the description of one of the sample tests. At lines 37 and 38:
As one could see, the description didn't match the assertion.
And as I mentioned before, it's not a critical problem, but led me into thinking that maybe private tests could be nesting more serious issues. My mistake.
Thank you for your kind advices.
Hello dear
warrior
For swift there are 200 tests with
n
< 70. If you are new to the site, i can advise you to always read descriptions thouroughly.Also, the private tests timing out while the public ones pass is a common theme on this website. The private tests are often way more thorough,
and have the requirement to include random tests.
As for the issue that you opened. Could you please elaborate what exactly is the problem here.
The test case is correct and 3 people have already solved it in swift.
Marked as issue because there is an issue at least with the public tests.
Two of them has the same ordinal numeration on the test description:
"doesn't work for the second example with six agents".
It's not critical, but led me to into thinking the private test also could have some problems...
Timeout on Swift 5.3: My public tests passed with 2.14ms, but the private ones got timedout at 12000ms.
Should I expect 6000x more computational power required for the private tests? This kata is a optimization problem?
If not, how can I check the private tests inputs (tried to print the inputs, not work for private tests...)
I'm new to the site, if anyone can help verifing the private tests for swift, thank you.
This comment is hidden because it contains spoiler information about the solution
Great solution
Thanks! Nice tip, will do :)
Nice use of recursion.
Feedback: try remove debug prints before submitting ;)
I submitted a tidier second version of this code.
There are a tidy second version submitted