Get Exp.
Learn this problemProblem statement
Note --> Feel free to check the source image below for the original problem statement :)
At a bustling tech company, there are n developers, each with their own set of experience points. The company is gearing up for an exciting hackathon and has come up with a unique way to form pairs of developers for the event. Their plan is to create pairs by matching the developer with the highest experience points with the one with the lowest experience points, and then move inward from both ends.
As the developers are paired, the company is interested in analyzing the combined experience of each pair. The combined experience of a pair is calculated as the average of the experience points of the two developers.
Your challenge is to determine how many unique values there are among these combined experience points.
In simpler terms, given the list of experience points for all developers, you need to find out how many distinct average values result from pairing the highest and lowest remaining experience points iteratively.
Function
getExp(exp: int[]) → intExamples
Example 1
exp = [1, 4, 1, 3, 5, 6]return = 2Example 2
exp = [1, 1, 1, 1, 1, 1]return = 1Example 3
exp = [1, 100, 10, 1000]return = 2Constraints
2 ≤ n ≤ 10^50 ≤ exp[i] ≤ 10^9n is an even numberMore Amazon problems
- Secure Maximum DeliveriesOA · Seen Jul 2026
- Find Median from Data StreamONSITE INTERVIEW · Seen Jul 2026
- Handwritten SigmoidPHONE SCREEN · Seen Jul 2026
- Handwritten SoftmaxPHONE SCREEN · Seen Jul 2026
- Koko Eating BananasONSITE INTERVIEW · Seen Jul 2026
- Loyal Customers Across Two DaysONSITE INTERVIEW · Seen Jul 2026
- Maximum System Memory CapacityOA · Seen Jul 2026
- Package Delivery SystemOA · Seen Jul 2026