← All problemsSign in

8 Use Priority Queue Please

You are given an array of $N$ integers as input. You have to do the following operations : - Print the maximum element in the array. - Take the maximum element in the array and divide by 2 (rounded down) and put it in the array again, i.e , take the max element x and put into array $\lfloor x/2 \rfloor$ if $\lfloor x/2 \rfloor \neq 0$. If there are multiple max elements with same value ,

HINT LADDERno hints yet
L1 Observation
L2 Technique
L3 Approach
L4 Pseudo-code
🔒
L5 Full solution
L5 unlocks only if you insist twice
solution.cppC++17

CodeSearch Tutor

Hints, not spoilers — it won’t hand over the full solution unless you insist.

voice by Sarvam AI

Sign in to chat with the tutor and save your progress.

Sign in to start