Ad
  • Custom User Avatar

    Hi! I noticed that in your answer you also converted the letter z to s, although I see no reason for this. I think the mistake is in this.

    The original sequence: jdtqzbq
    Correct sequence after conversion: jdtpzbq
    And the sum of the letters: 0 + -2 + 0 + 3 + -1 + 2 + -3 => -1, therefore Right side wins

    I hope I helped you figure it out.

  • Custom User Avatar

    Yes, the description is complete. You don't need to see the source (i.e. the body of the function) to understand what it does: it returns a TreeNode. All it does is abstract away the Box for you. I could post the code here, but frankly I think you're better served understand and accepting why this isn't necessary. If you look at the official documentation for any type, you'll notice that only the signature of methods is given, because that's all you need to know to work with it.

    EDIT:

    I've since realised that the reason one might want to see the full implementation is to use this locally in your IDE. My bad. I've updated the description to show the full implementation now.

  • Custom User Avatar
  • Custom User Avatar

    Probably a few hours, but it was a long time ago, so I really don't remember.

  • Custom User Avatar

    How much time have you spent on that? Have you went to the solution by yourself or tried to find these laws?
    @compoterguy103

  • Custom User Avatar

    It's the shortest, sure, but the best? If I saw this in production code I would be kinda miffed because the return function is indecipherable.

  • Custom User Avatar

    Agreed. It only worked with one of the two, and that should be better specified.

  • Custom User Avatar

    You mean why it hasn't got a lower rating, don't you? I guess it's because one needs to cope with the broadly advertised "inappropriate wording" of the kata... ;)

  • Custom User Avatar

    Fixed. See other posts.

  • Custom User Avatar

    ;)

    This is just that this kata as some troubles or weirdness or whatever (might be that I don't understand unicodes too) and this test doesn't pass with a weird behaviour (length of the input different of the output... !). So I hardcoded this test.

    Random tests are implemented, but only with standard characters, not unicodes.

    EDIT : might be related to the python version used. I didn't investigate much about that...

  • Custom User Avatar

    Exercise test cases are now fixed.

  • Custom User Avatar

    Description updated, more and random tests added.

  • Custom User Avatar

    I added tests (including 100 random tests), updated the description and changed the title.

    Please mark as resolved if you think these updates have fixed the kata!

  • Custom User Avatar

    Wow ! Marvel at the beauty.

  • Custom User Avatar

    That's very nice way to enforce generator. I've actually failed to get through one-liner before seeing the test code. That disassembly approach was quite aggressive.
    I have no clue to apply similar approach to this Kata though. So far I had no luck on differentiating between regular codes and one-liner equivalents using dis.dis() or any other inspect functions.

  • Loading more items...