Maximum possible number of iterations of while loop
<p><a href="https://i.stack.imgur.com/0aDy9.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/0aDy9.jpg" alt="enter image description here"></a></p>

<p>My answer is <code>46</code>(don't remember how I got it). I took an array in descending order, and simulated it. </p>

<p>Source: GATE-CS 2016 question</p>