Statistics

Problem Statement for "TheQuestionsAndAnswersDivOne"

Problem Statement

John and Brus have become very famous people all over the world, especially in Bolivia. A man in Bolivia decided to write a story about them. To make the story more truthful, he set up an interview with John. He prepared a list of distinct simple "Yes" or "No" questions and he enlisted the help of two friends to transcribe the interview. Each time he asked a question, one friend wrote down the question while the other friend wrote down the answer. He was very nervous when conducting the interview, so he might have asked some of the questions multiple times. However, John's answers always remained the same for the same questions.

Unfortunately, the friend who was writing down the questions lost his list. In a desperate attempt to remember the order in which he asked the questions, the Bolivian has decided to write down all the possible ways that he might have asked them. He knows for sure that he asked every question from his list at least once. You are given an int questions, which is the number of questions that were in his list, and a String[] answers, the i-th element of which is the answer to the i-th question he asked. Return the total number of ways in which he might have asked the questions.

Definition

Class:
TheQuestionsAndAnswersDivOne
Method:
find
Parameters:
int, String[]
Returns:
int
Method signature:
int find(int questions, String[] answers)
(be sure your method is public)

Constraints

  • questions will be between 2 and 9, inclusive.
  • answers will contain between questions and 9 elements, inclusive.
  • Each element of answers will be either "Yes" or "No".

Examples

  1. 2

    {"No", "Yes"}

    Returns: 2

    The two possible ways are: the first question followed by the second question, or vice versa.

  2. 2

    {"No", "No", "No"}

    Returns: 6

  3. 3

    {"Yes", "No", "No", "Yes"}

    Returns: 12

  4. 3

    {"Yes", "Yes", "Yes", "No"}

    Returns: 18

  5. 6

    {"No", "Yes", "Yes", "Yes", "Yes", "No", "No", "Yes"}

    Returns: 40320

  6. 6

    {"Yes", "No", "No", "Yes", "No", "Yes"}

    Returns: 720

  7. 4

    {"Yes", "No", "Yes", "No", "Yes", "Yes", "Yes", "No"}

    Returns: 1704

  8. 5

    {"No", "Yes", "No", "No", "No", "No", "Yes"}

    Returns: 4200

  9. 5

    {"No", "No", "No", "Yes", "No", "No", "Yes"}

    Returns: 4200

  10. 6

    {"Yes", "Yes", "Yes", "No", "No", "Yes", "No", "No", "No"}

    Returns: 169920

  11. 5

    {"No", "Yes", "Yes", "Yes", "No", "No", "No", "No", "Yes"}

    Returns: 33120

  12. 8

    {"No", "No", "No", "No", "Yes", "No", "Yes", "No", "Yes"}

    Returns: 725760

  13. 5

    {"Yes", "No", "No", "No", "No", "No"}

    Returns: 1200

  14. 5

    {"No", "Yes", "Yes", "No", "No"}

    Returns: 120

  15. 6

    {"No", "No", "No", "No", "No", "Yes", "No"}

    Returns: 10800

  16. 6

    {"No", "Yes", "No", "Yes", "No", "No", "Yes", "No", "No"}

    Returns: 216000

  17. 5

    {"No", "No", "Yes", "No", "Yes", "No", "No"}

    Returns: 4200

  18. 6

    {"Yes", "No", "No", "No", "No", "No", "No", "No"}

    Returns: 100800

  19. 5

    {"No", "No", "Yes", "No", "No", "Yes", "No", "Yes", "No"}

    Returns: 43920

  20. 9

    {"No", "Yes", "Yes", "No", "Yes", "No", "Yes", "No", "Yes"}

    Returns: 362880

  21. 3

    {"Yes", "Yes", "No", "Yes", "Yes"}

    Returns: 42

  22. 2

    {"Yes", "Yes", "No", "No", "Yes"}

    Returns: 2

  23. 3

    {"Yes", "Yes", "No", "No", "Yes", "Yes", "Yes", "No", "Yes"}

    Returns: 204

  24. 2

    {"Yes", "Yes", "No", "Yes", "No", "Yes", "Yes"}

    Returns: 2

  25. 2

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"}

    Returns: 126

  26. 5

    {"Yes", "Yes", "No", "Yes", "Yes", "No", "Yes"}

    Returns: 4200

  27. 4

    {"Yes", "Yes", "Yes", "Yes", "No"}

    Returns: 144

  28. 2

    {"Yes", "No", "Yes", "Yes", "Yes"}

    Returns: 2

  29. 2

    {"Yes", "No", "Yes", "Yes", "Yes"}

    Returns: 2

  30. 5

    {"Yes", "Yes", "No", "Yes", "Yes", "Yes"}

    Returns: 1200

  31. 8

    {"No", "Yes", "No", "No", "No", "No", "Yes", "Yes", "No"}

    Returns: 725760

  32. 9

    {"Yes", "Yes", "Yes", "No", "Yes", "Yes", "No", "No", "No"}

    Returns: 362880

  33. 8

    {"No", "Yes", "No", "Yes", "No", "Yes", "No", "No", "Yes"}

    Returns: 645120

  34. 7

    {"Yes", "No", "No", "Yes", "Yes", "No", "No", "No", "Yes"}

    Returns: 463680

  35. 7

    {"Yes", "Yes", "Yes", "No", "Yes", "Yes", "No", "Yes", "No"}

    Returns: 559440

  36. 9

    {"No", "Yes", "Yes", "No", "Yes", "No", "No", "Yes", "Yes"}

    Returns: 362880

  37. 7

    {"No", "No", "No", "Yes", "No", "No", "Yes", "Yes", "Yes"}

    Returns: 463680

  38. 9

    {"Yes", "Yes", "No", "Yes", "Yes", "Yes", "Yes", "Yes", "No"}

    Returns: 362880

  39. 7

    {"No", "No", "Yes", "Yes", "Yes", "No", "No", "Yes", "No"}

    Returns: 463680

  40. 7

    {"No", "No", "Yes", "No", "No", "No", "No", "Yes", "No"}

    Returns: 811440

  41. 8

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"}

    Returns: 40320

  42. 7

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"}

    Returns: 2328480

  43. 7

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes"}

    Returns: 141120

  44. 9

    {"No", "No", "No", "No", "No", "No", "No", "No", "No"}

    Returns: 362880

  45. 9

    {"No", "Yes", "No", "No", "No", "No", "Yes", "Yes", "No"}

    Returns: 362880

  46. 2

    {"No", "Yes", "No", "No", "No", "No", "Yes", "Yes", "No"}

    Returns: 2

  47. 8

    {"No", "Yes", "No", "No", "No", "No", "Yes", "Yes", "No"}

    Returns: 725760

  48. 9

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 362880

  49. 9

    {"No", "No", "No", "No", "No", "No", "No", "No", "No" }

    Returns: 362880

  50. 8

    {"No", "No", "No", "No", "No", "No", "No", "No", "No" }

    Returns: 1451520

  51. 7

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 2328480

  52. 9

    {"No", "Yes", "Yes", "No", "Yes", "No", "Yes", "No", "No" }

    Returns: 362880

  53. 6

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 1905120

  54. 7

    {"No", "No", "No", "No", "No", "No", "No", "No", "No" }

    Returns: 2328480

  55. 2

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "No" }

    Returns: 2

  56. 8

    {"Yes", "Yes", "Yes", "Yes", "No", "No", "No", "No", "No" }

    Returns: 645120

  57. 7

    {"Yes", "Yes", "Yes", "Yes", "No", "No", "Yes", "No", "No" }

    Returns: 463680

  58. 2

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 510

  59. 8

    {"Yes", "Yes", "Yes", "Yes", "Yes", "No", "No", "No", "No" }

    Returns: 645120

  60. 5

    {"Yes", "No", "No", "Yes", "Yes", "No", "No", "Yes", "Yes" }

    Returns: 33120

  61. 7

    {"Yes", "No", "No", "No", "Yes", "No", "No", "Yes", "Yes" }

    Returns: 463680

  62. 9

    {"Yes", "No", "Yes", "No", "Yes", "Yes", "Yes", "No", "No" }

    Returns: 362880

  63. 6

    {"Yes", "Yes", "No", "Yes", "No", "Yes", "No", "Yes", "Yes" }

    Returns: 216000

  64. 9

    {"Yes", "Yes", "Yes", "Yes", "Yes", "No", "No", "No", "Yes" }

    Returns: 362880

  65. 9

    {"Yes", "Yes", "Yes", "Yes", "No", "Yes", "Yes", "Yes", "Yes" }

    Returns: 362880

  66. 5

    {"Yes", "Yes", "Yes", "No", "No", "No", "No", "Yes" }

    Returns: 10320

  67. 7

    {"Yes", "Yes", "Yes", "No", "No", "No", "No", "Yes", "No" }

    Returns: 463680

  68. 9

    {"Yes", "Yes", "Yes", "Yes", "No", "No", "No", "No", "No" }

    Returns: 362880

  69. 5

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 834120

  70. 4

    {"No", "Yes", "Yes", "No", "Yes", "Yes", "No", "No", "Yes" }

    Returns: 3264

  71. 7

    {"Yes", "Yes", "Yes", "No", "Yes", "No", "No", "Yes", "Yes" }

    Returns: 559440

  72. 3

    {"Yes", "No", "No", "Yes" }

    Returns: 12

  73. 4

    {"Yes", "No", "No", "No", "Yes", "Yes", "Yes", "Yes" }

    Returns: 1704

  74. 4

    {"Yes", "Yes", "No", "No", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 8736

  75. 4

    {"Yes", "No", "Yes", "Yes", "Yes", "No", "No", "Yes", "No" }

    Returns: 3264

  76. 9

    {"No", "No", "No", "No", "No", "No", "No", "No", "Yes" }

    Returns: 362880

  77. 9

    {"No", "Yes", "Yes", "No", "No", "Yes", "No", "Yes", "Yes" }

    Returns: 362880

  78. 6

    {"No", "Yes", "No", "Yes", "No", "No", "No", "No" }

    Returns: 57600

  79. 8

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "Yes" }

    Returns: 1451520

  80. 4

    {"No", "No", "No", "No", "No", "No", "No", "No", "Yes" }

    Returns: 23184

  81. 7

    {"Yes", "Yes", "Yes", "Yes", "Yes", "Yes", "No", "No", "No" }

    Returns: 559440


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: