Kick start workout Problem

why don’t we use a priority_queue?
we can push the difference between two adjacent elements and then for each move, we can pop the top element and push (top/2) and (top-top/2) into the priority_queue

At the end top of priority_queue would be the answer.

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.