Find Lexicographically Smallest Permutation Maximizing Information Gain
Find the lexicographically smallest permutation that maximizes information gain for a given array. Information gain is calculated as the sum of i * data[p[i]] for a permutation p of integers 1 to n.
Asked at:
Amazon
Question Timeline
See when this question was last asked and where, including any notes left by other candidates.
All Regions
Late January, 2025
Amazon
Mid-level
Find the lexicographically smallest permutation that maximizes information gain for a given array. Information gain is calculated as the sum of i * data[p[i]] for a permutation p of integers 1 to n.
Hello Interview Premium
Your account is free and you can post anonymously if you choose.