Ad
  • Custom User Avatar

    Even simpler than I thought :)

  • Custom User Avatar

    Sure:

    1. It is definitely not the simple solution, and not the intended solution. If you have to do stuff to the list, you're doing it wrong.
    2. Test cases includes r = 1000000000. Think about how your approach will ever not timeout/run out of memory.
    3. The xrange issue is due to choosing the wrong Python version. You can choose the language version at the trainer, next to the language selection.
    4. Anyways, the existence of that failed test indicates that you've mutated the original list, despite how you might think otherwise. Test cases, even though can be poorly coded (using the same list throughout all tests), does not lie; failing at the same spot as others with a common cause indicates a strong correlation.
    5. I know you spent a few hours trying to figure out why it didn't work and is certainly very frustrated, but there is really nothing wrong with the kata (besides maybe how the test cases are written). So please, don't blame the kata and its author on something that is not their fault - if you write a sub-optimal algorithm and timeouts, that means you need to write a better algorithm :)
  • Custom User Avatar

    It's okay! Keep trying :)

  • Default User Avatar

    First, while definitely not being a power-user, the code I wrote is simple, and is really primitive. It appends the 0'th element of the list to this list twice, then pops its 0'th element. It returns the list[0] value after iterating r times. I actually use two list - I do not modify the original, I work on its copy.

    Second, while printing I have observed that the list from which I return the first position as a result for test case #X is then used as input list for test case #X+1. In the description, the list is predefined to 5 names. Its not my code who does that transferring of values between the test cases, it's something within the test cases themselves. It's an abbreviation from the definition of the exercise - and its not an abbreviation that I made. When I hard-coded the original list of names, I actually passed that TC I have described as broken. Input error, and not one from my side.

    Third, the xrange function does not work for this particular Kata, while it works everywhere else. It returns "name xrange is not defined" error.

    Finally, it is not the only error I have spotted in TC's in different Katas - its just the first one I had encountered. When I have started using CodeWards, I didn't knew Katas were available in different languages, and are translated between them. If I'd knew that, my comment would be different. It would say "Python test cases for this Kata are broken" instead of "This Kata is broken".

    I am not a power-programmer, but I am a power-tester. I've just spent hour making sure that I am justified in my judgement and I stand by my opinion, the Python TC's are broken.

    Please prove me wrong.

  • Custom User Avatar

    Just like in Python version, tests in Ruby version reuse the same list for all test cases for some reasons, so don't mutate the input.

  • Custom User Avatar

    I am sorry. I didn't mean to come across that way. It is hard when I can't use my voice. I will keep trying. Edit: Also I clearly need to learn to read the "total times completed" part before I post an issue.

  • Custom User Avatar

    Python tests reuse the same list for all test cases for some reasons, so don't mutate the input.

  • Custom User Avatar

    Python tests reuse the same list for all test cases for some reasons, so don't mutate the input.

    Also, the python version is a pretty bad kata translation (it doesn't even have random tests), so blame the translator, not the poor creator who already has to take the flak of people who're unaware of algorithmic complexity :)

  • Custom User Avatar

    Python tests reuse the same list for all test cases for some reasons, so don't mutate the input.

  • Custom User Avatar

    Python tests reuse the same list for all test cases for some reasons, so don't mutate the input.

  • Custom User Avatar

    Looks like an occasional problem of CW platform.

  • Custom User Avatar

    There are test cases with a very huge r. You don't want to generate that many objects.

  • Custom User Avatar

    ???

  • Custom User Avatar

    The phrase "simple to the point of being primitive" is usually reserved for power users.

    Anyways, CW is not known for having lots of people experienced in coding and algorithms solving katas, so it's not surprised that people blaming their oversight/ignorance/incompetence on the kata happens every day. And it's definitely not the kind of attitude one wants to have.

  • Custom User Avatar

    537 people have already solved this kata in C#.

    At least if you want to put the "I'm not an experienced programmer" part you don't want to be also so arrogant for the other half of your post.

    Anyways, there are test cases with r = 1000000000. Think about how to handle that.

  • Loading more items...