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 does not consider person with 0 votes (i.e, not in the first element of each rows combined). They have the least votes and should be removed first, followed by those who have the least votes amongst the voted candidates.
because n starts from 1 not from 0 like your array
From what I can see it should pass a few tests. However there are test cases that will use very high int numbers for
r
. Including 1,000,000,000. So eventually your code would end up taking too long to run to pass all the tests, or causenames
to get too large for memory. There is a mathmatical way to figure it out that will run quickly enough to pass all the tests.You can format your code using markdown. Add ``` to the beginning and end of code.
dont understand why?
r = 10
res = "Sheldon"
should it be "Penny"?
['Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard', 'Sheldon', 'Sheldon', 'Leonard', 'Leonard', 'Penny']
This comment is hidden because it contains spoiler information about the solution
Agreed. The specs on this kata range from incredibly vague to outright misleading. As a 4kyu problem, this can take an hour or longer for a user to complete - and if the kata description leads them in the wrong direction it can be incredibly frustrating.
Additionally, the kata builds the assumption that the data for votes will be received in a specific format (a,b,c,d,e) when the random tests use different data. This should be noted in the kata description.
Thank you. Indeed I misunderstand the question before and made lot of mistakes. I can submit my solution now.
Hi,
Thanks for your help! I'm a newer for coding. After a few days, I knew I made lots of mistakes here, and finally I can submit a solution.
This comment is hidden because it contains spoiler information about the solution
Regarding the "Language undefined is not supported" message, I can elicit that response by pasting in a URL to a kata and trying to submit a solution prior to logging in and selecting a language.
Make sure you've logged in to codewars and selected a language before trying to solve a kata.
Hi,
Your problem is that the limits of your loops are not consistent : with this code you may encounter cases where those executions are overlapping (with two more subcases : overlapping with no problem = works but inefficient ; overlapping with problems... that I'll let you find ;-) ) or are joined, or are disjoined (problematic too).
Hi,
The problem is at this part :
del signature[1,2]
there are never,
in slicing notations, so you should usedel signature[1:2]
(I'm guessing you want to return only the first element). Note that your first seven statements could be reduce to 1 line, in python. ;)Enjoy python !
PS : note that there might be some other errors too, I just indicated the notation problem.
This comment is hidden because it contains spoiler information about the solution
This comment is hidden because it contains spoiler information about the solution