Company: De Shaw_28thjuly

Difficulty: medium

Problem Statement

You are given an array A of length N , where A[i] is the productivity score of whichever employee originally sits in seat i (1-indexed). Before work starts, the manager gets to perform a single company-wide reseating, assigning every employee to a distinct new seat. When the employee who started at seat x ends up at seat y , that move contributes A x × |x - y| units to the team's total productivity score. Work out the highest total productivity score achievable through such a rearrangement. Function Description Complete the function: long long maximizeProductivity(int N, vector<long long>& A) which returns the maximum achievable productivity score. Constraints 2 ≤ N ≤ 2000 1 ≤ A i ≤ 10 9

More De Shaw_28thjuly OA questionsInterview experiences