FastPrepCount Teams Outscoring a Target Team

Count Teams Outscoring a Target Team

Bloomberg LP logoBloomberg LP● EasyNEW GRADOA
Learn

Problem statement

matches[i] = [homeTeam, awayTeam] and scores[i] = [homeGoals, awayGoals]. Every team appears in exactly one match.

Return how many teams scored strictly more goals than targetTeam.

Function

countTeamsOutscoring(matches: String[][], scores: int[][], targetTeam: String) → int

Examples

Example 1

matches = [["Red","Blue"],["Green","Yellow"],["Orange","Violet"]]scores = [[0,1],[2,5],[0,0]]targetTeam = "Blue"return = 2

Blue scored one; Green and Yellow scored more.

Constraints

  • Match and score arrays have equal length.
  • The target team appears exactly once.

More Bloomberg LP problems

See Bloomberg LP hiring insights
public int countTeamsOutscoring(String[][] matches, int[][] scores, String targetTeam) {
  // Write your code here.
}
matches[["Red","Blue"],["Green","Yellow"],["Orange","Violet"]]
scores[[0,1],[2,5],[0,0]]
targetTeam"Blue"
expected2
Checking account…