Problem Statement
John and Brus have an interest in team sports tournaments. They are currently investigating a basketball tournament. Basketball is a team sport in which two teams of five players try to score points against one another by placing a ball through a ten foot high hoop. Basketball is one of the most popular and widely viewed sports in the world.
There are n teams in the tournament. Each pair of teams plays exactly two games against each other. In the first of these games, one of the teams is the host, and in the second, the other team is the host. Each game results in one team winning. There are no draws. After the tournament is over, the team with the highest total number of wins is crowned the winner.
The tournament is currently in progress and the current results are described in the
Definition
- Class:
- TheBasketballDivTwo
- Method:
- find
- Parameters:
- String[]
- Returns:
- int
- Method signature:
- int find(String[] table)
- (be sure your method is public)
Constraints
- table will contain between 2 and 5 elements, inclusive.
- Each element of table will contain exactly n characters, where n is the number of elements in table.
- The j-th character of the i-th element of table, where i and j are different, will be 'W', 'L', or '?'.
- The i-th character of the i-th element of table will be 'X'.
Examples
{"X?", "?X"}
Returns: 1
One win for each team.
{"XW", "LX"}
Returns: 2
The tournament is over.
{"XWL", "?XW", "WLX"}
Returns: 2
The only game that hasn't been played yet is between the first and second teams. If the first team wins the game, all of the teams will finish with two wins.
{"XW?", "LX?", "??X"}
Returns: 2
{"X?", "LX"}
Returns: 1
{"X?", "LX"}
Returns: 1
{"XW?", "?XW", "??X"}
Returns: 2
{"XW?L", "?X??", "W?XL", "??WX"}
Returns: 3
{"XW?", "?X?", "WLX"}
Returns: 2
{"X?L", "LX?", "LWX"}
Returns: 2
{"X??", "WX?", "?WX"}
Returns: 2
{"XLW", "LXW", "?LX"}
Returns: 3
{"XLWL", "LX?W", "?WXL", "??LX"}
Returns: 3
{"XWWW", "WX?W", "WLXW", "?L?X"}
Returns: 4
{"XL?L", "?X?L", "??XL", "???X"}
Returns: 3
{"X??W?", "WX?W?", "??X?W", "LLWXW", "LL??X"}
Returns: 5
{"XWL?W", "?X?LL", "W?X??", "?L?XW", "LLLLX"}
Returns: 5
{"XWW", "WXL", "WLX"}
Returns: 2
{"XWW", "?XL", "??X"}
Returns: 2
{"X?W", "WX?", "L?X"}
Returns: 2
{"XW?L?", "?X?W?", "L?X?W", "LW?X?", "?WLWX"}
Returns: 4
{"X?L?L", "WXW??", "W?X?W", "??LXW", "LW?LX"}
Returns: 4
{"XLWLL", "?XW?W", "L?X?L", "?WWXW", "WLWWX"}
Returns: 5
{"XW?L?", "WXL?L", "??XL?", "?L?X?", "?L??X"}
Returns: 4
{"X?W?W", "?X???", "WLXLW", "WLLX?", "?LWLX"}
Returns: 4
{"XL?LL", "WX???", "?LX?W", "LLLXL", "WWWWX"}
Returns: 6
{"XWL?W", "WXLL?", "?WX?W", "W?LX?", "????X"}
Returns: 5
{"X?W?L", "?X???", "L?XWL", "?W?X?", "?LWLX"}
Returns: 4
{"X?L??", "?X??W", "W?X??", "L?WX?", "???WX"}
Returns: 4
{"XL?L?", "LX?LW", "WLXLW", "???XW", "LL??X"}
Returns: 5
{"X?W??", "?X??W", "??X??", "???X?", "?W??X"}
Returns: 4
{"XW??", "?X??", "?WX?", "??WX"}
Returns: 3
{"X???", "WX??", "??X?", "???X"}
Returns: 3
{"X?W??", "?XW??", "??XL?", "??WX?", "????X"}
Returns: 4
{"X???", "?XW?", "??X?", "?L?X"}
Returns: 3
{"XW?W?", "LX???", "??X??", "???XL", "????X"}
Returns: 4
{"X????", "?X???", "?LXW?", "???X?", "W???X"}
Returns: 4
{"XWWL", "?X?W", "??X?", "???X"}
Returns: 3
{"X???", "?X??", "??X?", "???X"}
Returns: 3
{"XWL??", "?X???", "WWXWW", "??WXW", "?WWLX"}
Returns: 5
{"X????", "?X???", "??X??", "???X?", "????X"}
Returns: 4
{"X???", "?X??", "??X?", "???X"}
Returns: 3
{"X??", "?X?", "??X"}
Returns: 2
{"X?", "?X"}
Returns: 1
{"XWWLL", "WXWLW", "WWXLL", "WLWXW", "WLLWX"}
Returns: 6
{"XLWLW", "LXLWL", "WWXWW", "WWWXL", "WWWLX"}
Returns: 5
{"XLWWW", "WXLWW", "LWXWL", "WLWXL", "WLWLX"}
Returns: 6
{"XWWWW", "LX???", "L?X??", "L??X?", "L???X"}
Returns: 8
{"X????", "?X???", "??X??", "???X?", "????X" }
Returns: 4
{"X?", "?X" }
Returns: 1
{"XLL", "LXL", "WWX" }
Returns: 4
{"X?W", "WXL", "LLX" }
Returns: 3
{"XWWWW", "WXWWW", "WWXWW", "LLLXW", "????X" }
Returns: 5