Ad
  • Custom User Avatar

    For people who may also be confused by the "target floor can be any floor between 1 to this maximum height" => in cases when it is not possible to throw an egg, the answer is not 1, but 0 - existence of the target floor from which the egg will not break is not guaranteed. There may be 0 such floors. The description seems misleading.

  • Custom User Avatar

    My wrong solution passed in the case of ships properly not touching each other or being diagonally conflicting, but having the wrong cell count per type. My wrong solution failed the following test case:

    int[,] field = new int[10,10]
    {{1, 0, 0, 0, 1, 1, 1, 0, 0, 0},
    {1, 0, 1, 0, 0, 0, 0, 0, 1, 0},
    {1, 0, 0, 0, 1, 1, 1, 0, 1, 0},
    {1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    {0, 0, 0, 0, 1, 1, 1, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 1, 0},
    {0, 0, 0, 1, 0, 0, 0, 0, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 1, 0, 0},
    {0, 0, 0, 0, 0, 0, 0, 0, 0, 0}};

    Assert.IsFalse(BattleshipField.ValidateBattlefield(field));