Given 4 arrays wins, draws, scored, conceded of size N these arrays represent the stats of N teams. The array wins[i] represents the number of wins of the i'th team, draws[i] represents the number of draws of the i'th team, scored[i] represents the score of the i'th team, and conceded[i] represents the concede of the i'th team.
For every win, a team is rewarded 3 points and for every draw, a team is rewarded 1 point. The task is to find the highest and second-highest scoring teams. If there is a tie between the points, it will be resolved by taking the difference between scored[i] - conceded[i].
Return the indexes of the teams.
Complete the function findTopTwoTeams in the editor.
findTopTwoTeams has the following parameters:
int[] wins: an array of integers representing the number of winsint[] draws: an array of integers representing the number of drawsint[] scored: an array of integers representing the scoresint[] conceded: an array of integers representing the conceded scores
Returns
int[]: an array of two integers representing the indexes of the top two teams
Hello! Uber assessment comes with 4 coding questions. Here are the other 3 in the same batch 🥝 -
wins = [1, 2, 3] draws = [1, 1, 1] scored = [10, 20, 30] conceded = [12, 23, 12] return = [2, 1]
- Total Palindrome Substring CostOA · Seen Jun 2026
- Earliest Time All Users Are ConnectedPHONE SCREEN · Seen May 2026
- Tournament Rounds by RankPHONE SCREEN · Seen May 2026
- Farthest Seat AssignmentONSITE INTERVIEW · Seen May 2026
- Convex Function MinimizationPHONE SCREEN · Seen May 2026
- Maximal Square AreaONSITE INTERVIEW · Seen May 2026
- First Unique IP Hitting the ServerPHONE SCREEN · Seen May 2026
- Jump Game with Prime-Step RuleOA · Seen May 2026
public int[] findTopTwoTeams(int[] wins, int[] draws, int[] scored, int[] conceded) {
// write your code here
}