SDE II
Amazon Shopping is running a reward collection event for its customers.
There are n customers and the i-th customer has collected initialRewards[i] points so far.
One final tournament is to take place where:
Given an integer array initialRewards of length n, representing the initial reward points of the customers before the final tournament:
Find the number of customers i (1 ≤ i ≤ n) such that, if the i-th customer wins the final tournament, they would have the highest total points.
Note -
The total points = initialRewards[i] + n (if they win). Other customers also get points in the tournament depending on their ranks (from n - 1 to 1). You must check if the i-th customer, upon winning, ends up with the highest total score, regardless of how others place.
initialRewards = [1, 3, 4] n = 3 return = 2
initialRewards = [5, 7, 9, 11] n = 4 return = 1
initialRewards = [8, 10, 9] n = 3 return = 2

1 ≤ n ≤ 10^50 ≤ initialRewards[i] ≤ 10^5- Complete constraints added on 06-18-2025
- Count Promotional PeriodsOA · Seen Jun 2026
- Find Maximum Total Amount (SDE I, Fungible :)Seen Jun 2026
- Get Minimum AmountOA · Seen Jun 2026
- Find Minimum CostOA · Seen Jun 2026
- Get Smallest Base SegmentOA · Seen Jun 2026
- Select Least Resource TasksOA · Seen Jun 2026
- Product Category Group SizesPHONE SCREEN · Seen May 2026
- Count Connected ComponentsPHONE SCREEN · Seen May 2026
public int countPossibleWinners(int[] initialRewards, int n) {
// write your code here
}