Problem Statement
You are given a String[] maze representing a grid of cells. Empty cells are denoted as '.', occupied cells are denoted as '#', and all other cells contain uppercase letters. A maze is considered correct if there are at least 3 empty cells and all the letters are different.
If the maze contains less than 3 empty cells, return "There are less than 3 empty cells!". Otherwise, if there are at least two equal letters, return "There are at least two equal letters!". If the maze is correct, return "Everything is ok!". All quotes are for clarity only.
If the maze contains less than 3 empty cells, return "There are less than 3 empty cells!". Otherwise, if there are at least two equal letters, return "There are at least two equal letters!". If the maze is correct, return "Everything is ok!". All quotes are for clarity only.
Definition
- Class:
- FirstMazeTask
- Method:
- checkCorrectness
- Parameters:
- String[]
- Returns:
- String
- Method signature:
- String checkCorrectness(String[] maze)
- (be sure your method is public)
Constraints
- maze will contain between 1 and 50 elements, inclusive.
- Each element of maze will contain between 1 and 50 elements, inclusive.
- Each element of maze will contain equal number of elements.
- Each character in maze will be '.', '#', or 'A'..'Z'.
Examples
{"A..", "#.#", "#.B"}Returns: "Everything is ok!"
{"A.C", "#.#", "#DB"}Returns: "There are less than 3 empty cells!"
{"A.B", "#.#", "#DB"}Returns: "There are less than 3 empty cells!"
{"A.B", "#.#", "#.B"}Returns: "There are at least two equal letters!"
{".....", ".....", ".....", "....."}Returns: "Everything is ok!"