Problem Statement
In a computer game called "Zeroes of Blight and Tragic", players command heroes who fight each other in epic battles. The heroes do not fight each other directly. Instead, each hero leads an army that consists of many distinct types of creatures.
Upon inspecting an enemy hero, a player learns an approximate composition of the hero's army. The player can then use this information to decide whether to attack that hero or flee.
When describing the number of creatures in an army unit, the game uses a fixed set of words (called quantifiers). Each word represents a range of values, as listed below. For example, the word "Horde" can represent any number between 50 and 99, inclusive.
The quantifiers are as follows:
- Few: 1-4
- Several: 5-9
- Pack: 10-19
- Lots: 20-49
- Horde: 50-99
- Throng: 100-249
- Swarm: 250-499
- Zounds: 500-999
- Legion: 1000 or more
We are examining an enemy hero.
You are given a
Consider the following statement: "In total, there are Q creatures in this hero's army." In this statement, Q is one of the quantifiers mentioned above.
Find all quantifiers for which that the statement may be true.
Return a
If there are multiple quantifiers that may correspond to the size of the hero's army, you have to output all of them. You may output them in any order, but you have to output each valid quantifier exactly once. Also, note that the return value is case-sensitive.
Definition
- Class:
- ArmySize
- Method:
- getSum
- Parameters:
- String[]
- Returns:
- String[]
- Method signature:
- String[] getSum(String[] units)
- (be sure your method is public)
Constraints
- units will contain between 1 and 7 elements, inclusive.
- Each element of units will be one of "Few", "Several", "Pack", "Lots", "Horde", "Throng", "Swarm", "Zounds", and "Legion".
Examples
{"Lots","Lots"}
Returns: {"Lots", "Horde" }
This hero has, for example, "Lots" of skeletons and "Lots" of ghouls. In other words, there are somewhere between 20 and 49 skeletons and somewhere between 20 and 49 ghouls. What quantifier can be used to describe the total number of creatures in this hero's army? One possibility is "Lots". For example, if there are 22 skeletons and 24 ghouls, the total number of creatures is 22+24 = 46, which still falls into the range for "Lots". Another possibility is "Horde". For example, if there are 40 skeletons and 45 ghouls, we have a total of 85 creatures. There are no other possibilities. For example, "Throng" cannot be true, because this hero's army will surely have fewer than 100 creatures.
{"Throng","Few","Few"}
Returns: {"Throng", "Swarm" }
The total size of this army is somewhere between 102 and 257 creatures, inclusive, so it's either a "Throng" or a "Swarm".
{"Few","Few","Few","Few","Several"}
Returns: {"Several", "Pack", "Lots" }
Here we have three possibilities: This hero's army may have a total of 9 creatures, in which case the correct quantifier is "Several". This hero's army may have anywhere between 10 and 19 creatures, in which case the correct quantifier is "Pack". This hero's army may have anywhere between 20 and 25 creatures, in which case the correct quantifier is "Lots".
{"Few"}
Returns: {"Few" }
{"Few","Few"}
Returns: {"Few", "Several" }
{"Few","Few","Few"}
Returns: {"Few", "Several", "Pack" }
{"Few","Few","Few","Few"}
Returns: {"Few", "Several", "Pack" }
{"Few","Few","Few","Few","Few"}
Returns: {"Several", "Pack", "Lots" }
{"Few","Few","Few","Few","Few","Few"}
Returns: {"Several", "Pack", "Lots" }
{"Few","Few","Few","Few","Few","Few","Few"}
Returns: {"Several", "Pack", "Lots" }
{"Several"}
Returns: {"Several" }
{"Several","Several"}
Returns: {"Pack" }
{"Several","Several","Several"}
Returns: {"Pack", "Lots" }
{"Several","Several","Several","Several"}
Returns: {"Lots" }
{"Several","Several","Several","Several","Several"}
Returns: {"Lots" }
{"Several","Several","Several","Several","Several","Several"}
Returns: {"Lots", "Horde" }
{"Several","Several","Several","Several","Several","Several","Several"}
Returns: {"Lots", "Horde" }
{"Pack"}
Returns: {"Pack" }
{"Pack","Pack"}
Returns: {"Lots" }
{"Pack","Pack","Pack"}
Returns: {"Lots", "Horde" }
{"Pack","Pack","Pack","Pack"}
Returns: {"Lots", "Horde" }
{"Pack","Pack","Pack","Pack","Pack"}
Returns: {"Horde" }
{"Pack","Pack","Pack","Pack","Pack","Pack"}
Returns: {"Horde", "Throng" }
{"Pack","Pack","Pack","Pack","Pack","Pack","Pack"}
Returns: {"Horde", "Throng" }
{"Lots"}
Returns: {"Lots" }
{"Lots","Lots","Lots"}
Returns: {"Horde", "Throng" }
{"Lots","Lots","Lots","Lots"}
Returns: {"Horde", "Throng" }
{"Lots","Lots","Lots","Lots","Lots"}
Returns: {"Throng" }
{"Lots","Lots","Lots","Lots","Lots","Lots"}
Returns: {"Throng", "Swarm" }
{"Lots","Lots","Lots","Lots","Lots","Lots","Lots"}
Returns: {"Throng", "Swarm" }
{"Horde"}
Returns: {"Horde" }
{"Horde","Horde"}
Returns: {"Throng" }
{"Horde","Horde","Horde"}
Returns: {"Throng", "Swarm" }
{"Horde","Horde","Horde","Horde"}
Returns: {"Throng", "Swarm" }
{"Horde","Horde","Horde","Horde","Horde"}
Returns: {"Swarm" }
{"Horde","Horde","Horde","Horde","Horde","Horde"}
Returns: {"Swarm", "Zounds" }
{"Horde","Horde","Horde","Horde","Horde","Horde","Horde"}
Returns: {"Swarm", "Zounds" }
{"Throng"}
Returns: {"Throng" }
{"Throng","Throng"}
Returns: {"Throng", "Swarm" }
{"Throng","Throng","Throng"}
Returns: {"Swarm", "Zounds" }
{"Throng","Throng","Throng","Throng"}
Returns: {"Swarm", "Zounds" }
{"Throng","Throng","Throng","Throng","Throng"}
Returns: {"Zounds", "Legion" }
{"Throng","Throng","Throng","Throng","Throng","Throng"}
Returns: {"Zounds", "Legion" }
{"Throng","Throng","Throng","Throng","Throng","Throng","Throng"}
Returns: {"Zounds", "Legion" }
{"Swarm"}
Returns: {"Swarm" }
{"Swarm","Swarm"}
Returns: {"Zounds" }
{"Swarm","Swarm","Swarm"}
Returns: {"Zounds", "Legion" }
{"Swarm","Swarm","Swarm","Swarm"}
Returns: {"Legion" }
{"Swarm","Swarm","Swarm","Swarm","Swarm"}
Returns: {"Legion" }
{"Swarm","Swarm","Swarm","Swarm","Swarm","Swarm"}
Returns: {"Legion" }
{"Swarm","Swarm","Swarm","Swarm","Swarm","Swarm","Swarm"}
Returns: {"Legion" }
{"Zounds"}
Returns: {"Zounds" }
{"Zounds","Zounds"}
Returns: {"Legion" }
{"Zounds","Zounds","Zounds"}
Returns: {"Legion" }
{"Zounds","Zounds","Zounds","Zounds"}
Returns: {"Legion" }
{"Zounds","Zounds","Zounds","Zounds","Zounds"}
Returns: {"Legion" }
{"Zounds","Zounds","Zounds","Zounds","Zounds","Zounds"}
Returns: {"Legion" }
{"Zounds","Zounds","Zounds","Zounds","Zounds","Zounds","Zounds"}
Returns: {"Legion" }
{"Legion"}
Returns: {"Legion" }
{"Legion","Legion"}
Returns: {"Legion" }
{"Legion","Legion","Legion"}
Returns: {"Legion" }
{"Legion","Legion","Legion","Legion"}
Returns: {"Legion" }
{"Legion","Legion","Legion","Legion","Legion"}
Returns: {"Legion" }
{"Legion","Legion","Legion","Legion","Legion","Legion"}
Returns: {"Legion" }
{"Legion","Legion","Legion","Legion","Legion","Legion","Legion"}
Returns: {"Legion" }
{"Swarm","Throng"}
Returns: {"Swarm", "Zounds" }
{"Several","Few"}
Returns: {"Several", "Pack" }
{"Few","Lots"}
Returns: {"Lots", "Horde" }
{"Swarm","Few"}
Returns: {"Swarm", "Zounds" }
{"Zounds","Lots"}
Returns: {"Zounds", "Legion" }
{"Horde","Throng"}
Returns: {"Throng", "Swarm" }
{"Pack","Several"}
Returns: {"Pack", "Lots" }
{"Pack","Several"}
Returns: {"Pack", "Lots" }
{"Zounds","Horde","Legion"}
Returns: {"Legion" }
{"Throng","Few","Few"}
Returns: {"Throng", "Swarm" }
{"Zounds","Throng","Zounds"}
Returns: {"Legion" }
{"Pack","Throng","Lots"}
Returns: {"Throng", "Swarm" }
{"Zounds","Legion","Few"}
Returns: {"Legion" }
{"Several","Several","Pack"}
Returns: {"Lots" }
{"Swarm","Few","Legion"}
Returns: {"Legion" }
{"Lots","Swarm","Legion"}
Returns: {"Legion" }
{"Swarm","Pack","Horde"}
Returns: {"Swarm", "Zounds" }
{"Legion","Several","Horde"}
Returns: {"Legion" }
{"Few","Swarm","Few"}
Returns: {"Swarm", "Zounds" }
{"Lots","Lots","Swarm"}
Returns: {"Swarm", "Zounds" }
{"Horde","Horde","Zounds","Pack"}
Returns: {"Zounds", "Legion" }
{"Legion","Horde","Swarm","Several"}
Returns: {"Legion" }
{"Few","Horde","Lots"}
Returns: {"Horde", "Throng" }
{"Lots","Horde","Horde"}
Returns: {"Throng" }
{"Several","Pack","Few"}
Returns: {"Pack", "Lots" }
{"Several","Horde","Pack"}
Returns: {"Horde", "Throng" }
{"Horde","Few","Few"}
Returns: {"Horde", "Throng" }
{"Horde","Few","Several"}
Returns: {"Horde", "Throng" }
{"Several","Pack","Lots"}
Returns: {"Lots", "Horde" }
{"Horde","Few","Several"}
Returns: {"Horde", "Throng" }
{"Pack","Several","Pack"}
Returns: {"Lots" }
{"Pack","Lots","Pack","Few"}
Returns: {"Lots", "Horde" }
{"Pack","Lots","Few","Pack"}
Returns: {"Lots", "Horde" }
{"Several","Pack","Few","Lots"}
Returns: {"Lots", "Horde" }
{"Lots","Few","Pack","Pack"}
Returns: {"Lots", "Horde" }
{"Few","Horde","Pack","Pack"}
Returns: {"Horde", "Throng" }
{"Several","Lots","Horde","Few"}
Returns: {"Horde", "Throng" }
{"Horde","Several","Few","Few"}
Returns: {"Horde", "Throng" }
{"Pack","Few","Several","Pack"}
Returns: {"Lots", "Horde" }
{"Horde","Pack","Horde","Few"}
Returns: {"Throng" }
{"Pack","Pack","Few","Several"}
Returns: {"Lots", "Horde" }
{"Several","Pack","Lots","Horde"}
Returns: {"Horde", "Throng" }
{"Few","Lots","Horde","Lots"}
Returns: {"Horde", "Throng" }
{"Horde","Horde","Several","Several","Lots"}
Returns: {"Throng", "Swarm" }
{"Horde","Few","Several","Horde","Pack"}
Returns: {"Throng" }
{"Lots","Pack","Lots","Pack","Few"}
Returns: {"Horde", "Throng" }
{"Horde","Horde","Horde","Lots","Lots"}
Returns: {"Throng", "Swarm" }
{"Pack","Pack","Few","Several","Horde"}
Returns: {"Horde", "Throng" }
{"Horde","Few","Few","Several","Horde"}
Returns: {"Throng" }
{"Few","Few","Few","Lots","Horde"}
Returns: {"Horde", "Throng" }
{"Lots","Horde","Several","Lots","Horde"}
Returns: {"Throng", "Swarm" }
{"Pack","Lots","Lots","Pack","Horde"}
Returns: {"Throng" }
{"Few","Pack","Few","Few","Horde"}
Returns: {"Horde", "Throng" }
{"Lots","Few","Pack","Pack","Lots"}
Returns: {"Horde", "Throng" }
{"Lots","Pack","Few","Several","Few"}
Returns: {"Lots", "Horde" }
{"Few","Pack","Lots","Pack","Several"}
Returns: {"Lots", "Horde", "Throng" }
{"Horde","Several","Several","Several","Horde"}
Returns: {"Throng" }
{"Few","Lots","Horde","Several","Horde"}
Returns: {"Throng", "Swarm" }
{"Horde","Pack","Several","Lots","Horde","Horde"}
Returns: {"Throng", "Swarm" }
{"Few","Horde","Lots","Few","Several","Horde"}
Returns: {"Throng", "Swarm" }
{"Pack","Pack","Lots","Horde","Few","Horde"}
Returns: {"Throng", "Swarm" }
{"Several","Horde","Horde","Lots","Pack","Few"}
Returns: {"Throng", "Swarm" }
{"Several","Several","Horde","Several","Few","Pack"}
Returns: {"Horde", "Throng" }
{"Several","Lots","Horde","Lots","Horde","Several"}
Returns: {"Throng", "Swarm" }
{"Lots","Lots","Several","Lots","Few","Horde"}
Returns: {"Throng", "Swarm" }
{"Few","Several","Several","Lots","Lots","Several"}
Returns: {"Horde", "Throng" }
{"Few","Horde","Several","Pack","Several","Lots"}
Returns: {"Horde", "Throng" }
{"Pack","Horde","Pack","Several","Lots","Lots"}
Returns: {"Throng" }
{"Several","Lots","Several","Lots","Few","Pack"}
Returns: {"Horde", "Throng" }
{"Horde","Horde","Pack","Pack","Lots","Several"}
Returns: {"Throng", "Swarm" }
{"Few","Horde","Lots","Lots","Pack","Lots"}
Returns: {"Throng", "Swarm" }
{"Pack","Lots","Lots","Few","Few","Few"}
Returns: {"Horde", "Throng" }
{"Lots","Pack","Several","Horde","Pack","Lots"}
Returns: {"Throng" }
{"Horde","Lots","Several","Lots","Pack","Pack"}
Returns: {"Throng" }
{"Few","Pack","Few","Few","Few","Several"}
Returns: {"Pack", "Lots" }
{"Several","Pack","Lots","Several","Pack","Several"}
Returns: {"Horde", "Throng" }
{"Pack","Horde","Lots","Pack","Several","Several","Horde"}
Returns: {"Throng", "Swarm" }
{"Lots","Lots","Lots","Few","Few","Lots","Pack"}
Returns: {"Horde", "Throng" }
{"Several","Few","Horde","Several","Horde","Lots","Lots"}
Returns: {"Throng", "Swarm" }
{"Lots","Several","Pack","Few","Horde","Few","Horde"}
Returns: {"Throng", "Swarm" }
{"Lots","Pack","Horde","Few","Few","Pack","Horde"}
Returns: {"Throng", "Swarm" }
{"Horde","Several","Pack","Horde","Several","Horde","Pack"}
Returns: {"Throng", "Swarm" }
{"Few","Horde","Pack","Few","Several","Several","Pack"}
Returns: {"Horde", "Throng" }
{"Lots","Lots","Several","Lots","Pack","Several","Few"}
Returns: {"Horde", "Throng" }
{"Few","Several","Horde","Horde","Few","Several","Horde"}
Returns: {"Throng", "Swarm" }
{"Horde","Lots","Horde","Pack","Pack","Several","Several"}
Returns: {"Throng", "Swarm" }
{"Few","Few","Pack","Horde","Lots","Pack","Horde"}
Returns: {"Throng", "Swarm" }
{"Few","Several","Pack","Horde","Horde","Horde","Pack"}
Returns: {"Throng", "Swarm" }
{"Lots","Horde","Several","Pack","Horde","Pack","Lots"}
Returns: {"Throng", "Swarm" }
{"Pack","Several","Lots","Lots","Several","Several","Few"}
Returns: {"Horde", "Throng" }
{"Pack","Lots","Few","Pack","Few","Pack","Pack"}
Returns: {"Horde", "Throng" }
{"Lots","Horde","Several","Lots","Several","Several","Several"}
Returns: {"Throng" }
{"Horde","Pack","Several","Several","Few","Several","Few"}
Returns: {"Horde", "Throng" }
{"Pack","Several","Horde","Few","Several","Pack","Lots"}
Returns: {"Throng" }
{"Lots","Few","Few","Horde","Few","Few","Several"}
Returns: {"Horde", "Throng" }
{"Few","Lots","Pack","Few","Lots","Several","Few"}
Returns: {"Horde", "Throng" }
{"Horde","Lots","Horde","Several","Several","Several","Pack"}
Returns: {"Throng", "Swarm" }
{"Swarm","Pack","Several"}
Returns: {"Swarm", "Zounds" }
{"Lots","Throng","Horde"}
Returns: {"Throng", "Swarm" }
{"Swarm","Few","Several"}
Returns: {"Swarm", "Zounds" }
{"Throng","Few","Horde"}
Returns: {"Throng", "Swarm" }
{"Horde","Lots","Zounds"}
Returns: {"Zounds", "Legion" }
{"Swarm","Horde","Throng"}
Returns: {"Swarm", "Zounds" }
{"Swarm","Zounds","Lots"}
Returns: {"Zounds", "Legion" }
{"Horde","Few","Lots"}
Returns: {"Horde", "Throng" }
{"Several","Several","Few"}
Returns: {"Pack", "Lots" }
{"Swarm","Swarm","Lots"}
Returns: {"Zounds", "Legion" }
{"Lots","Several","Swarm","Swarm"}
Returns: {"Zounds", "Legion" }
{"Swarm","Few","Throng","Zounds"}
Returns: {"Zounds", "Legion" }
{"Few","Throng","Lots","Pack"}
Returns: {"Throng", "Swarm" }
{"Few","Few","Zounds","Horde"}
Returns: {"Zounds", "Legion" }
{"Pack","Zounds","Throng","Several"}
Returns: {"Zounds", "Legion" }
{"Pack","Few","Few","Legion"}
Returns: {"Legion" }
{"Pack","Lots","Zounds","Several"}
Returns: {"Zounds", "Legion" }
{"Legion","Swarm","Horde","Several"}
Returns: {"Legion" }
{"Few","Zounds","Few","Swarm"}
Returns: {"Zounds", "Legion" }
{"Throng","Throng","Horde","Pack"}
Returns: {"Swarm", "Zounds" }
{"Pack","Swarm","Lots","Legion","Throng"}
Returns: {"Legion" }
{"Lots","Several","Lots","Zounds","Horde"}
Returns: {"Zounds", "Legion" }
{"Pack","Several","Swarm","Several","Few"}
Returns: {"Swarm", "Zounds" }
{"Several","Several","Throng","Throng","Few"}
Returns: {"Throng", "Swarm", "Zounds" }
{"Legion","Throng","Zounds","Horde","Few"}
Returns: {"Legion" }
{"Several","Few","Lots","Legion","Swarm"}
Returns: {"Legion" }
{"Lots","Swarm","Swarm","Throng","Legion"}
Returns: {"Legion" }
{"Legion","Legion","Horde","Pack","Few"}
Returns: {"Legion" }
{"Few","Zounds","Lots","Swarm","Horde"}
Returns: {"Zounds", "Legion" }
{"Legion","Few","Horde","Throng","Swarm"}
Returns: {"Legion" }
{"Horde","Horde","Throng","Throng","Few","Pack"}
Returns: {"Swarm", "Zounds" }
{"Few","Throng","Throng","Zounds","Throng","Swarm"}
Returns: {"Legion" }
{"Legion","Few","Several","Few","Zounds","Swarm"}
Returns: {"Legion" }
{"Zounds","Several","Legion","Legion","Lots","Swarm"}
Returns: {"Legion" }
{"Zounds","Zounds","Legion","Swarm","Pack","Few"}
Returns: {"Legion" }
{"Zounds","Throng","Several","Horde","Several","Zounds"}
Returns: {"Legion" }
{"Legion","Pack","Swarm","Throng","Pack","Legion"}
Returns: {"Legion" }
{"Horde","Swarm","Pack","Zounds","Pack","Pack"}
Returns: {"Zounds", "Legion" }
{"Zounds","Several","Zounds","Legion","Several","Swarm"}
Returns: {"Legion" }
{"Horde","Throng","Horde","Legion","Horde","Swarm"}
Returns: {"Legion" }
{"Swarm","Legion","Swarm","Several","Several","Swarm","Pack"}
Returns: {"Legion" }
{"Throng","Pack","Few","Pack","Swarm","Legion","Lots"}
Returns: {"Legion" }
{"Pack","Several","Throng","Throng","Zounds","Zounds","Lots"}
Returns: {"Legion" }
{"Several","Several","Horde","Swarm","Throng","Swarm","Several"}
Returns: {"Zounds", "Legion" }
{"Few","Pack","Legion","Horde","Throng","Few","Few"}
Returns: {"Legion" }
{"Horde","Few","Throng","Legion","Lots","Few","Lots"}
Returns: {"Legion" }
{"Several","Horde","Lots","Horde","Legion","Pack","Zounds"}
Returns: {"Legion" }
{"Lots","Pack","Horde","Few","Legion","Lots","Throng"}
Returns: {"Legion" }
{"Swarm","Several","Pack","Swarm","Horde","Legion","Swarm"}
Returns: {"Legion" }
{"Horde","Legion","Horde","Pack","Few","Legion","Pack"}
Returns: {"Legion" }
{"Lots", "Lots", "Several" }
Returns: {"Lots", "Horde", "Throng" }
{"Legion", "Legion", "Legion", "Legion", "Legion", "Legion", "Legion" }
Returns: {"Legion" }
{"Legion", "Legion" }
Returns: {"Legion" }