Ad
  • Default User Avatar

    That's an issue with your solution, not with the kata.

  • Default User Avatar

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

  • Default User Avatar

    Should "A۱" count as "A1"? I see some python solutions that convert the second character to int, and "۱" converts to 1

    Of course, the invalid input requirement is dumb, especially non-strings or strings that don't describe a location in a coordinate system. But if you're gonna have it...

  • Default User Avatar

    As funny as I think it is to find a comment like this on a g964 kata, I see no issue here. Part of solving a problem is identifying what the problem is. There's no obligation to describe the problem in as simple terms as possible.

  • Default User Avatar

    Some description problems:

    You are given a non-null array of integers.

    drop "non-null". null is not an array. You also don't need to mention that the array isn't going to be a giraffe, tea cup, or banana.

    --

    method

    I would rather see function, or drop the word entirely, but this is nowhere near as offensive as the null thing

    --

    nowhere in the description does it say that there can't be gaps in the tree, such as:

            17
           /
          0
         /
       -4
       /
      3
     /
    15
    
  • Default User Avatar

    If a chunk represents an integer such as the sum of the cubes of its digits is divisible by 2

    ->

    If the sum of a chunk's digits is divisible by 2

    There was an issue about it 7 years ago which for some reason got marked resolved.

  • Default User Avatar

    You've got plenty to go on though. Compare the two results. Do it manually/consider which is correct. Read instructions.

  • Default User Avatar

    don't do bad things with memory /shrug

    might want to reproduce it locally where you have access to more tools.

    or use a different language that has better memory safety if this isn't something you want to deal with

  • Default User Avatar

    I made two forks that address mutability:

    1. Immutable dataclass Node - being immutable makes it very simple
    2. Check for mutation - complicated mess, obviously

    Both expect specifically IndexError. Unclear whether that change should be made though. It's not necessarily incorrect by codewars standards to raise an unspecified exception, and this breaks the vast majority of solutions, including ones that I would consider completely correct with the current spec.

  • Default User Avatar

    As a bonus this solution works for infinite lists and negative index because it'll hit recursion limit. (doesn't work as great for high indices though)

  • Default User Avatar

    Unspecified. The choices of excption type look strange across the board. java accepts any exception type according to description (haven't looked at tests) and C# doesn't use IndexOutOfRangeException which I assume is more appropriate and PHP might have something like that exception too instead of InvalidArgumentException .. OutOfRangeException looks to be a thing. Ruby accepts both throw and raise for some reason.

    Some languages return the data which seems more in line of the intent of the kata, while others the entire node, but don't bother checking if it's the correct node.

    This is fine.

  • Default User Avatar

    if you look at my (python) solution though, THAT is incorrectly passing, as it doesn't return the nth node, but a node containing the value that the nth node contains

    this issue probably applies to most if not all languages.

    one might argue that it's out of scope. it's not. they ask for the node, not the data. if they wanted the data they should have asked for the data. and then test for what's asked for. nor is it a nitpick about python's concept of identity. this function spec is similar to drop, but that is not at all what my solution does.

    bonus issue: poor formatting in python's initial code. never fails to annoy me.

  • Default User Avatar

    no that is.. correct. it'll cause a throw when a throw is asked for which otherwise wouldn't happen.

  • Default User Avatar

    same as for any other language, print it. see unsafePerformIO

  • Default User Avatar

    closing, since I hand-checked one of the tests that your code fails on, you give wrong answer

    v1=733 v2=760 g=141
    [5, 13, 19] should equal [5, 13, 20]
    
  • Loading more items...