Ad
  • Custom User Avatar

    You can start by being given a starting map. It has inputs = I; outputs = O; empty elements = E. For inputs and outputs you can unambiguously say where their boundaries are. For example, between two inputs there can be no boundary, between an input and an output there must be a boundary, etc. So it is worth starting with this logic, marking all possible initial boundaries.
    After this work is done you need to make an assumption about the empty element E, it can be either an input or an output. So, making an assumption for each E, you need to find the maximum number of elements that can be outputs when the line around all inputs will be closed.
    Regarding the question about Kruskal's algorithm. I haven't used it. However, you will need to do checks in the process that you can get from an arbitrary entry point to any other entry point. Perhaps you can come up with an implementation using the algorithm you mentioned).
    I hope this helps you get your act together and solve the problem.

  • Default User Avatar

    I asked someone else what my first steps with this problem should be, and they suggested trying to find the minimum spanning tree with Kruskal's algorithm, but I don't understand how I could use that here. They haven't solved this kata either, but that was what they were going to start with. Is Kruskal's the way to go here? I don't think this problem needs graphs...