We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
There are a couple of things. Once you hit count == goal, you have to realise that it might be true that mid - 1 also produces the same result and so does mid - 2. You have to get the minimum out of that. I recommend you have a while loop which keeps reducing mid once you hit count == goal and keep rechecking.
Minimum Time Required
You are viewing a single comment's thread. Return to all comments →
There are a couple of things. Once you hit count == goal, you have to realise that it might be true that mid - 1 also produces the same result and so does mid - 2. You have to get the minimum out of that. I recommend you have a while loop which keeps reducing mid once you hit count == goal and keep rechecking.