As an aspiring developer, you are required to develop a result analysis service for a car game on Amazon games.
There are n even records of d players who participated in different events in form of [race id, player's id, player's time]. For some race id, a player's ranking id decided based on the increasing order of their finish time. If two players have the same finish time, the one with a lower id is ranked lower.
The average standing of any player is the average of their various positions in all the races they competed in, expressed in the form of a fraction p/q. If there are multiple possible such fractions, reduce them such that p is the minimum possible.
Return a 2-dimensional array where each element i contains the ith player's p and q as described above. If the player did not compete in any races, the player's p and q values are both -1.
Complete the function getAverageStanding which has the following parameters:
int d: the number of playersint records[n][3]: each record[i] contains [race id, player id, player time]
d = 3 records = [[1, 1, 100], [1, 2, 200], [2, 1, 500]] return = [[-1, -1], [1, 1], [2, 1]]
N/A (If you know it, feel free to let us know ^^ tyvm!
- Closest Version DateONSITE INTERVIEW Β· Seen Jul 2026
- Maximum Concurrent Processes (Bar Raiser Round)ONSITE INTERVIEW Β· Seen Jul 2026
- Maximum Product New RatingOA Β· Seen Jul 2026
- Permutation SorterOA Β· Seen Jul 2026
- Get Distinct Pairs (Also apply to AS intern)Seen Jul 2026
- Maximum Final ValueSeen Jul 2026
- Minimum Delivery Center InconvenienceOA Β· Seen Jun 2026
- Unfulfilled Customers by Inventory PriorityOA Β· Seen Jun 2026
public int[][] getAverageStanding(int d, int[][] records) {
// write your code here
}