Tap here to switch tabs
Problem
Submissions

Problem: Best Team With No Conflicts

Try to solve the Best Team With No Conflicts problem.

Statement

You are given two integer arrays, scores and ages, of identical length, where scores[i] and ages[i] represent the score and age of the iextthi^{ ext{th}} player, respectively.

You wish to choose a team that achieves the maximum possible total score. A conflict arises if a younger player has a strictly higher score than an older player. No conflict exists between players who share the same age.

Return the highest overall score achievable by choosing a valid team with no conflicts.

Constraints:

  • 1≤1 \leq scores.length, ages.length ≤1000\leq 1000

  • scores.length ==== ages.length

  • 1≤1 \leq scores[i] ≤106\leq 10^6

  • 1≤1 \leq ages[i] ≤1000\leq 1000

⋮
Tap here to switch tabs
Problem
Submissions

Problem: Best Team With No Conflicts

Try to solve the Best Team With No Conflicts problem.

Statement

You are given two integer arrays, scores and ages, of identical length, where scores[i] and ages[i] represent the score and age of the iextthi^{ ext{th}} player, respectively.

You wish to choose a team that achieves the maximum possible total score. A conflict arises if a younger player has a strictly higher score than an older player. No conflict exists between players who share the same age.

Return the highest overall score achievable by choosing a valid team with no conflicts.

Constraints:

  • 1≤1 \leq scores.length, ages.length ≤1000\leq 1000

  • scores.length ==== ages.length

  • 1≤1 \leq scores[i] ≤106\leq 10^6

  • 1≤1 \leq ages[i] ≤1000\leq 1000