Panda Guru LogoPanda
Guru

Amazon SDE2 OA

Round 1

Questions: There are n points, the ith point initially has a weight of weight[i] and is located at position i on the x-axis. In a single operation, the ith point can be moved to the right by a dist[i]. Given the weight and dist, find the minimum number of operations required to sort the points by their weights.

Example:

n = 4, weight = [3, 6, 5, 1] and dist = [4, 3, 2, 1]

number of operations = 1 + 2 + 2 = 5

Constraints:

public static long getMinOperations(List<Integer> weights, List<Integer> dist){...}
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.