having n towers, find the max and min possible height for the longest tower after d days

Revision en1, by Alireza_Asadi, 2021-07-05 15:48:48

Hi Everyone! I have asked this question on stackexchange and got no chance getting an answer to my problem. Will you plz help me solve it?

I have come up with a solution but I don't exactly know if it is true. I think for the tallest possible height, we can always get to that by adding d to the highest tower. and for the lowest possible height, we can sort the array and add 1 to m lowest towers in a for loop and keep the array sorted as we add them. finally the tallest tower will have the minimum height. Am I correct?

Tags #algorithms, #greedy

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Alireza_Asadi 2021-07-05 18:53:41 70
en1 English Alireza_Asadi 2021-07-05 15:48:48 744 Initial revision (published)