How to solve this problem ?

Revision en3, by atlasworld, 2019-06-13 21:32:59

Given an array A of N numbers, you have to perform B operations. In each operation, you have to pick any one of the N elements and add original value(value stored at index before we did any operations) to it's current value. You can choose any of the N elements in each operation.

Perform B operations in such a way that the largest element of the modified array(after B operations) is minimised. Return an integer corresponding to the minimum possible largest element after K operations.

Example:

Input : A = [1, 2, 3, 4] B = 3

Output : 4

Explanation : After the 1st operation the array would change to [2, 2, 3, 4] After the 2nd operation the array would change to [3, 2, 3, 4] After the 3rd operation the array would change to [4, 2, 3, 4]

A : [ 8, 6, 4, 2 ] B : 8 The expected returned value : 12

Any idea.

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en9 English atlasworld 2019-06-13 23:02:06 89
en8 English atlasworld 2019-06-13 22:59:07 3 Tiny change: 'lem is sold, one mor' -> 'lem is solved, one mor'
en7 English atlasworld 2019-06-13 22:55:02 284
en6 English atlasworld 2019-06-13 21:41:23 59
en5 English atlasworld 2019-06-13 21:35:03 50
en4 English atlasworld 2019-06-13 21:33:16 32
en3 English atlasworld 2019-06-13 21:32:59 84 Reverted to en1
en2 English atlasworld 2019-06-13 21:32:45 84
en1 English atlasworld 2019-06-13 21:32:27 875 Initial revision (published)