Problem Statement
The digit d will appear in element i of ability if person i can perform task d. You are required to assign each of the given people to exactly one of the 6 tasks (numbered '0' through '5'). Two people cannot be assigned to the same task. Return the number of assignments possible. Two assignments differ if there is a person who is assigned a different task in each assignment.
Definition
- Class:
- MatchCounts
- Method:
- howMany
- Parameters:
- String[]
- Returns:
- int
- Method signature:
- int howMany(String[] ability)
- (be sure your method is public)
Constraints
- ability will contain between 1 and 6 elements, inclusive.
- Each element of ability will contain between 1 and 6 characters, inclusive.
- Each character in ability will be a digit between '0' and '5', inclusive.
- No character will appear more than once in a single element of ability.
Examples
{"045"}Returns: 3
Person 0 can perform 3 different tasks.{"01","23"}Returns: 4
Two choices for person 0 and two choices for person 1.{"01","01"}Returns: 2
Both people have two choices, but not all 2*2 possibilities are feasible.{"0","0"}Returns: 0
{"012345","012345","012345","012345","012345","012345"}Returns: 720