Skip to content

Day 271 #553

Closed
Closed

Description

@vaskoz

Good morning! Here's your coding interview problem for today.

This problem was asked by Netflix.

Given a sorted list of integers of length N, determine if an element x is in the list without performing any multiplication, division, or bit-shift operations.

Do this in O(log N) time.

Activity

  1. self-assigned this
    on May 20, 2019
  2. vaskoz commented on May 20, 2019

    @vaskoz
    OwnerAuthor

    The weird part of this question is that it's classified as hard despite it appearing to be a simple binary search.

  3. mgkeeley commented on Feb 12, 2020

    @mgkeeley

    you performed a division in your binary search! I think that is why it's considered hard!

  4. vaskoz commented on Feb 12, 2020

    @vaskoz
    OwnerAuthor

    you performed a division in your binary search! I think that is why it's considered hard!

    @mgkeeley I forgot to link the follow-on PRs to this issue that fixed that mistake. If you're interested please take a look at the revised solution. I used this algorithm to divide by 2 without multiplication, division or bit shifting.

  5. SwapnilJavanjal commented on Feb 18, 2020

    @SwapnilJavanjal

    Anyone got answer?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions