Binary Search Speedrun - Binary Search / Speedrun

https://algo.monster/problems/binary-search-speedrun

Options 3 and 4 are the same.

These options are all missing pieces of code. Which makes it a guessing game instead of interpreting the code

There is a difference in line 6.

Why are all the answer options wrong? This needs to be fixed @editors.

Hello. I am unable to go to the next speedrun questions. I can only access the first one out of 8. Thanks.

which piece is missing? the questions are tailored to the template from earlier sections. if you’ve completed those it should be obvious what the options are referring to.

can you elaborate which options are wrong?

The phrasing of the final question is honestly atrocious.

you had to click an option to go to the next question. we just updated the ui to always show the next button

speed run question 4/8:
…
Line 5: (idx % 2): # odd
…
should it be even?

hi, (idx % 2) evaluates to true when remainder is 1. we’ll change it to be more explicit in the next deploy

On these speedrun questions, what is the suggested approach? Is the goal to just understand binary search concepts and answer the multiple-choice question correctly (or) also dive deep into the leetcode question at hand as well and ensure comprehension of that also? Thanks in advance!

1 Like

In question 4, options 3 and 4 are exactly the same.

Is there a way to toggle the programming language used for the multiple choice options?

1 Like

Typo in the Q4 hint “is is”

typo in Q7:
For example, s = "||**||**|*", and a query [3, 8] denotes the substring "*||******|"
substring should be “||**|”

I really didn’t like the answer of question 2. It is very confusing why to use this value for your end 1000000000. Only get the max value of your Array instead of using a hardcode Value. This is my answer on leetCode. Using that hardcoded value give us a very slow performance

public int minEatingSpeed(int[] piles, int h) {
    int start=1;
    int end=Integer.MIN_VALUE;
    for(int i=0;i<piles.length;i++)
    {
        if(piles[i]>end)
        {
            end=piles[i];
        }
    }
    int answer=-1;
    while (start<=end)
    {
        int mid=end+(start-end)/2;
        if(possibleAnswer(mid,piles,h))
        {
            answer=mid;
            end=mid-1;
        }else {
            start=mid+1;
        }
    }
    return answer;
}

private static boolean possibleAnswer(int mid, int[] piles, int h) {
    int hoursTaken=0;
    for(int i=0;i<piles.length;i++)
    {
        double partialAnswer=(double) piles[i]/mid;
        hoursTaken=(int)Math.ceil(partialAnswer)+hoursTaken;
    }
    return hoursTaken<=h;
}

A couple feedbacks for the mod:

  1. It would still be great to have a leetcode/sandbox-like environment to run our own code with automated test cases, like in the other exercises. I want to be able to try the solutions I came up with and see if I missed any edge cases
  2. It would also be nice to have an UI where you can scroll through the 8 exercises without having to hit “Next” like iterating through a Linked List. Simply a table of contents that links to all the problems would be nice. That would make it easier to navigate the problems quickly for reviewing purposes.

yes, I came here to same this as well