Ad
  • Default User Avatar

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

  • Default User Avatar

    In Python, dataclass refers to a specific builtin library: https://docs.python.org/3/library/dataclasses.html

    It can be confusing to mention it here.

  • Default User Avatar

    I think this is supposed to say "the provided lists should not be modified" as lists are provided by-reference in Python and therefore can be accidentally changed.

  • Default User Avatar

    Wasn't this done intentionally to ensure that MList returns MList?

  • Default User Avatar

    I'm not entirely sure why this was based on producing an ordered list instead of a set either, I think maybe the author wasn't aware of sets in Python.

  • Default User Avatar

    We know MList implements list, so:

    test.expect(lst == list(mlisted))
    

    will force it to use list.__eq__

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    The wording in this could maybe do with some rethinking. Instead of saying the sequence is graph-like, perhaps change the wording to something like:

    Write a function which determines if the provided sequence of vertex degrees can be represented by a simple graph.

    this introduces the idea of a simple graph up front instead of bringing it in later.

    Now instead of going through the proxy of graph-like, we can directly explain what a simple graph is:

    A simple graph is a graph without any loops (a vertex with an edge linking back to itself) and without multiple edges between any two vertices. A sequence of degrees can be represented by a simple graph if there exists any graph which satisfies these properties with the provided vertex degrees.

    After front-loading that explanation we can then move on to demonstrating this:

    The graph below represents a simple graph.
    
    (2)-----(3)-----(3)-----(1)
     |       |       |
    (2)     (2)      |
     |       |       |
     \------(3)------/
    
    If you take the degrees from each vertex we end up with the sequence [2, 3, 3, 1, 2, 2, 3].
    
    This second graph below however does not represent a simple graph, because it has a loop that folds back in on itself:
    
    (2)--\
     |    |
      \--/
    
    If we were to take all the degrees from each vertex (of which there is only one) in this graph, we would have the sequence [2].
    
    So from these two graphs we can conclude that the sequence [2, 3, 3, 1, 2, 2, 3] can be represented as a simple graph so the function would return true, while the sequence [2] can not so the function would return false.
    

    (However I've never written a Kata before so take this suggestion with a grain of salt)

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

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

  • Default User Avatar

    1 = 0001
    4 = 0100
    5 = 0101

    2 = 0010
    5 = 0101
    7 = 0111

    3 = 0011
    6 = 0110
    7 = 0111

  • Loading more items...