Ad
  • Default User Avatar
  • Custom User Avatar

    Spoiler flag plz.

    hint: don't use max(list), it's O(n) time complexity, and total will be $O(n^2)$ , time out.

    and list.index(item) is $O(n)$, too.

  • Default User Avatar

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

  • Default User Avatar

    Okay, can we real quick agree that this is a javascript specific kata?
    Nobody else thinks [] == 0

    All other translations here are shitposts IF it is important to the kata that there be mixed types in the input.

    However, they are there. So I then claim it clearly is not important, and further does not add anything to the non-js languages. (I'm including coffeescript with js)

    Python is mistranslated. In python, False is defined to have the value zero. The python translation claims it's not zero. The python translation is wrong. It further allows changing type between int and float which is nonsense.

    The C# translation already doesn't care.

    So then, to fix this:

    Option 1: Remove all non-js languages.
    Option 2: Remove False from python translation
    Option 3: Pretend the kata doesn't exist and leave it broken.
    Option 4: Remove the mixed types.

    1: can't.
    2: is a band-aid and doesn't change the fact that the javascript translation is a completely different problem
    3: really?
    4: only option that leaves things in a sane state, ignoring that it is misranked by 2 ranks but that's already the case.

    4 further allows accepting translations currently in limbo

    I'm making the first step here, with python, and if I get this through, I will continue pushing for the other languages to follow suit (either by painstakingly figuring out how to write them myself or by getting others to do it)
    python update: 3.8, new test framework, no more mixed types - list of int only

  • Default User Avatar

    False truly has the value 0 in python. the kata treats it like a special case (not zero) which I would claim is a translation error
    the is operator is not really appropriate here. this isn't about object identity.

  • Custom User Avatar

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

  • Custom User Avatar

    Teshan_ss, please mark your posts as having spoiler content when posting code like that.

  • Default User Avatar

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

  • Custom User Avatar

    In binary, 0 = False/OFF and 1 = True/ON. In your code, this line to be exact, if item is 0:, will also count False in.

    Using your code, an array of [False, 0] will return an array of [0, 0]. Hence, the extra zero.

  • Default User Avatar

    yes I know. I'm asking why..? Why when it comes to False ..in line 3 - if item is 0 or if 0 is item become True ..?
    Any help.. or suggestions..

  • Custom User Avatar

    Your result returned an extra 0 at the end of the array.

  • Default User Avatar

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