Guide me to prepare for competitive programming

I can fix this problem , I am a bachelor student from C.S and interested to solve this question

is this from some live hiring challenge or contest?

Suppose the equal heights of the rods (after destruction is done is H). Obviously all the rods which were of strictly height less than H will have to be destroyed completely and of height >=H have to be destroyed by amount h-H, where h is the initial height of the rod(h>=H). So? Can you proceed from here?

take an average of heights as h. and if a height rod is less than h, destroy it completely otherwise the height of rod - h. try it. can you give link of problem.