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.
Nice, here's a O(n) solution
or perhaps even:
for item in strs:
print(item.split(' '))
['1', '2']
['1', '', '2']
['1', '', '', '2']
['1', '', '', '', '2']
a zero length string, each time the dlimiter (a space) 'splits' other delimiters (other sapces)
Thank you!
Yes, see it for yourself:
https://docs.python.org/2.7/library/functions.html#round
https://docs.python.org/3.5/library/functions.html#round
This comment is hidden because it contains spoiler information about the solution
Won't this unnecessarily perform calculations which could be bypassed by testing for 1 pillar?
No need to apologize, you're correct.
If there are are more than 10 projects but fewer than 3 unpopular projects the result will be too short.
Therefore this solution is not correct.
As for that second point: Yes, that's on purpose. If there are 10 or fewer projects the result must contain all of them.
I just got "lucky" that this covers the test case without unpopular projects.
I apologize in advance if I'm wrong, but as clever as this is I think it fails to fill the minimum quota of 10 by filling the deficit of 'Unpopular' with 'Popular'.
Am I missing something??
"If there are less than 7 popular projects, or less than 3 unpopular projects, fill the gaps from the other group of projects if possible."
Also:
"If there are "less than" 10 projects in total, just return all projects." You've got <= 10.
Issue with your code is not the same as KATA issue :/ Java has 8000+ completions, so I'm pretty sure the tests are fine.
I'm not really familiar with that error message, but maybe you're trying to throw an error where it's not needed? No try-catch blocks should be needed here, as all inputs should be valid.
If you can't resolve it, try posting your code here, format it properly and mark it as spoiler.
Closing.
When summit my solution I get 4 messages like:
./src/test/java/DescendingOrderTest.java:9: error: unreported exception Exception; must be caught or declared to be thrown
assertEquals(0, DescendingOrder.sortDesc(0));
But in my tests, I test for this very same case plus:
and they all pass. ????
Any tips? Please .....
I can see you haven't sorted before flipping the numbers. Try turning it into a string then sorting first.
Your question is too vague, rephrase it. One possible answer is write it in the trainer.
Can someone please tell me what I'm supposed to do with my solution?
Thanks