Statistics

Problem Statement for "MatchCounts"

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

  1. {"045"}

    Returns: 3

    Person 0 can perform 3 different tasks.

  2. {"01","23"}

    Returns: 4

    Two choices for person 0 and two choices for person 1.

  3. {"01","01"}

    Returns: 2

    Both people have two choices, but not all 2*2 possibilities are feasible.

  4. {"0","0"}

    Returns: 0

  5. {"012345","012345","012345","012345","012345","012345"}

    Returns: 720

  6. {"402","251340","2530"}

    Returns: 40

  7. {"520134"}

    Returns: 6

  8. {"3","015","5"}

    Returns: 2

  9. {"45230","140","2","130"}

    Returns: 18

  10. {"3","2504","013425","1","30"}

    Returns: 6

  11. {"452","024513","342105","253","34","1302"}

    Returns: 40

  12. {"510234","52013","3","015","1"}

    Returns: 8

  13. {"453210","45301","14","043","405231"}

    Returns: 90

  14. {"431025"}

    Returns: 6

  15. {"3","0412","2"}

    Returns: 3

  16. {"1502","3","0","3"}

    Returns: 0

  17. {"24031","021","3","2054","5203","420513"}

    Returns: 28

  18. {"1","53014","314025"}

    Returns: 16

  19. {"12035","513"}

    Returns: 12

  20. {"20","502431"}

    Returns: 10

  21. {"243015","312540"}

    Returns: 30

  22. {"2","32","2304"}

    Returns: 2

  23. {"15","0423","354012","301"}

    Returns: 48

  24. {"405312","3","5042","4","423510","1345"}

    Returns: 10

  25. {"213","105432","5413"}

    Returns: 40

  26. {"35412","50142","043","02","40152","41"}

    Returns: 28

  27. {"50413","35"}

    Returns: 8

  28. {"3514","14"}

    Returns: 6

  29. {"014","25041","01253","4","3201"}

    Returns: 28

  30. {"021453"}

    Returns: 6

  31. {"53","4","50231"}

    Returns: 8

  32. {"14352","2401","3105"}

    Returns: 48

  33. {"045","1","215430","2345"}

    Returns: 30

  34. {"1","42315","3245","045321"}

    Returns: 36

  35. {"2154","2","12350"}

    Returns: 10

  36. {"4253","53","4","351","402531","102"}

    Returns: 10

  37. {"240513","103","1025","234","21504","1302"}

    Returns: 72

  38. {"325410","4053","0354","02","51402","1"}

    Returns: 28

  39. {"213045","0","2"}

    Returns: 4

  40. {"21","5","52"}

    Returns: 1

  41. {"0", "01234", "01234" }

    Returns: 12

  42. {"245", "145", "125" }

    Returns: 11

  43. {"5", "5" }

    Returns: 0


This problem statement is the exclusive and proprietary property of TopCoder, Inc. Any unauthorized use or reproduction of this information without the prior written consent of TopCoder, Inc. is strictly prohibited. (c)2024, TopCoder, Inc. All rights reserved.
This problem was used for: