Ad
  • Default User Avatar
  • Default User Avatar

    The details specified are sufficient to solve the problem here ... test your solution and see if it passes the test cases!

  • Custom User Avatar

    I completely agree. I found the wording confusing. I did not know if I was to increment and decrement an element outside of the stack.

  • Custom User Avatar
  • Default User Avatar

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

  • Default User Avatar

    @l2iisk
    Did you get resolution on this? I ran into the same issue.
    You're kinda going down the wrong path.

    Let me know if you need further clarification.

  • Custom User Avatar

    "No additional keys" test checks that the input and output of partial_keys are equal.

  • Default User Avatar

    Fixed.
    Anyway, strange, as the original code used random.choice from the beginning and was only available for python 2.7.

  • Default User Avatar

    Don't worry :)

    You are slightly misunderstanding the concept of 4-connectivity. It doesn't make sense to speak of a "4-connected pixel" without referring to another one. 4-connectivity is the technical way of referring to two pixels being connected either vertically or horizontally (excluding diagonally), but one cannot be either by itself. Here are some examples:

    We say these two are 4-connected pixels
    +----------+
    | *** ** * |
    | *xx*** **|
    | ** *   * |
    |    *     |
    +----------+
    
    On the contrary, these are not
    +----------+
    | **x ** * |
    | *x**** **|
    | ** *   * |
    |    *     |
    +----------+
    
    And, of course, neither are these
    +----------+
    | *** ** * |
    | *x*x** **|
    | ** *   * |
    |    *     |
    +----------+
    

    A 4-connected component is a series of pixels which form what is called a "connected component" if we se the image as a graph. This means that if we choose any two points inside the 4-connected component, we can find a path between them jumping only from a pixel to another if they are connected in that way.

    An example:

    +----------+
    | *** ** x |
    | ****** xx|
    | ** *   x |
    |    *     |
    +----------+
    
  • Custom User Avatar

    The kata is retired...

  • Default User Avatar

    A label can be declared at any point in the code. It's still possible to do execution with labels on the fly, but that'd be quite a bit harder.

  • Custom User Avatar

    No, you're wrong, because the same amount of people that got on got off, so it's wrong to assume it was 0. It affects the following steps, see:

    station:    1 2 3  4  5  6  7
    got on:     5 3 8  11 19 30 0 
    got off:    0 3 3  8  11 19 32
    on the bus: 5 5 10 13 21 32 0
    
  • Custom User Avatar

    I guess the problem is you don't know in the second step how many persons got on the bus, you assumed 0 and that's not the case, you should calculate it given the number of persons got off at the last station.