Ad
  • Default User Avatar

    This code should not be "Best practice" for at least the 2 following reasons:
    It is inefficient since it checks the entire grid for every move instead of focusing on the pieces around the latest one added to the grid.
    The 2 if statements are so complex and similar that they should be put into a function taking either 'Y' or 'R' as parameter. This would help during development and maintenance.

  • Default User Avatar

    Wouldn't using set ensure the result is sorted though?

  • Default User Avatar

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