Ad
  • Custom User Avatar

    You are probably correct, you actually are, but in reality you do not need to care for that. You break out of the loop once you get to the fist smallest number that is not in the list, you won't keep looping O(n) where n is the whole range from min to max. I know that I am not considering the worst case scenario here but I was unable to think of a better algo! :D