Retired

League Champions (retired)

Description:

Implement a function named winner(results) which takes the match results of each team in the league, and returns who won the championship (got the most points).

A team wins if it's score in a game is higher than the other team and is awarded 3 points.

A team loses if it's score in a game is lower than the other team and is awarded 0 points.

The game ties if both teams score is the same and each team will be awarded 1 point.

Example Input:

{
  teamA: ["1:0", "3:3"],
  teamB: ["0:1", "3:1"],
  teamC: ["3:3", "1:3"]
}

Output would be: 'teamA'. Since teamA got 4 points, while teamB got 3 points, and teamC got 1 point.

No 2 teams wlll have the same number of points at the end of the league. There will be no empty inputs.

Fundamentals

More By Author:

Check out these other kata created by Kadishay

Stats:

CreatedFeb 1, 2019
Warriors Trained54
Total Skips0
Total Code Submissions221
Total Times Completed31
JavaScript Completions31
Total Stars1
% of votes with a positive feedback rating68% of 22
Total "Very Satisfied" Votes14
Total "Somewhat Satisfied" Votes2
Total "Not Satisfied" Votes6
Total Rank Assessments23
Average Assessed Rank
6 kyu
Highest Assessed Rank
1 kyu
Lowest Assessed Rank
8 kyu
Ad
Contributors
  • Kadishay Avatar
  • cliffstamp Avatar
Ad