Find Top Two Teams
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 🥝 -