I've got an API endpoint which looks like this: http://foo.bar/rest-method/{identifier}.
This API returns an object that looks like that:

    name: "Example",
    version: ""

Now I know that the entry with the identifier 2923711253 has got version while the entry with the identifier 2923823024 has

I want to find out which identifier is the last one using version and which is the first one using I call it 'the breaking point'.

Of course I could write a loop which simply checks all the identifiers which are between the two definied one's, but that seems very inefficient to me.

What algorithm should be used here?

1 Answer 1


If it is guaranteed that higher identifier means not lesser version then the fastest way is binary search.

  • indeed, git or hg bisect
    – jk.
    Nov 9, 2016 at 12:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.