Quantcast
Channel: User blacktide - Stack Overflow
Viewing all articles
Browse latest Browse all 49

Answer by blacktide for AlgoExpert Question, Tournament Winner, Not passing all test cases

$
0
0

You should use containsKey on your Hashtable instead of contains on this line:

if (!tableTeamNameAndPoints.contains(winningTeamName)) {

When you use contains, you're checking if the Hashtable contains a key that maps to the value provided. It's equivalent to the containsValue method.

You can also remove the second if statement which is not needed (the condition is always true) and has the same contains problem:

if (tableTeamNameAndPoints.contains(winningTeamName)) {

Viewing all articles
Browse latest Browse all 49

Trending Articles