Problem Statement
Let's consider a standard six-sided die. Each side contains a distinct number between 1 and 6. We can represent a single die as a sequence of 6 digits in the following order: the number on its top side, bottom side, left, right, front and back sides. You are given a String[] givenDice, each element of which represents a single die in the described format.
Your task is to determine the number of distinct dice in givenDice. Two dice are considered equal if they can be rotated in such a way that the numbers on the corresponding sides are all equal.
Definition
- Class:
- DistinctDice
- Method:
- getDistinct
- Parameters:
- String[]
- Returns:
- int
- Method signature:
- int getDistinct(String[] givenDice)
- (be sure your method is public)
Constraints
- givenDice will contain between 1 and 50 elements, inclusive.
- Each element of givenDice will contain exactly 6 characters.
- Each character of each element of givenDice will be a digit between '1' and '6', inclusive.
- Within each element of givenDice, all characters will be distinct.
Examples
{"123456","654321"}Returns: 1
{"145326","154236","216543"}Returns: 3
{"165324"}Returns: 1
{"546231", "245631", "531462", "524631", "614235", "415623", "423651", "316254", "432165", "316452", "135426", "643512"}Returns: 10