Ad
  • Custom User Avatar

    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.

  • Custom User Avatar

    because n starts from 1 not from 0 like your array

  • Custom User Avatar

    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 cause names 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.

  • Custom User Avatar

    You can format your code using markdown. Add ``` to the beginning and end of code.

    def code():
      return 1
    
  • Custom User Avatar

    dont understand why?
    r = 10
    res = "Sheldon"
    should it be "Penny"?
    ['Sheldon', 'Leonard', 'Penny', 'Rajesh', 'Howard', 'Sheldon', 'Sheldon', 'Leonard', 'Leonard', 'Penny']

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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.

  • Custom User Avatar

    Thank you. Indeed I misunderstand the question before and made lot of mistakes. I can submit my solution now.

  • Custom User Avatar

    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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    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.

  • Default User Avatar

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

  • Default User Avatar

    Hi,

    The problem is at this part : del signature[1,2] there are never , in slicing notations, so you should use del 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.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution