Panda Guru LogoPanda
Guru

Salesforce Hackerrank Assesment

Round 1

Questions: In an array of integers of size n, we have costs in each entry of the array. We have to select k costs from n such that the total cost is least. We have to select the costs in the order in which they appear and if we select a cost ranging from an index i to index j, it should be the maximum in that range.

int[] costs = {10, 5, 20, 7, 8, 9, 12, 15, 18}; int k = 3;

We can select 10, 5 and max(20, 7, 8, 9, 12, 15, 18) = 20 => 10 + 5 + 20 = 35.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.