Given a sorted list of strings and the last entry is null. You cannot use the list.length to determine the length of the list, but come with an approach efficient than O(n) to find the end Index of list or length of list?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Fast and dirty, but it should get things done.
This is just like a guess a number scenario. Start with an arbitrarily large number.
The good news? This is O(logn). The bad news? You have a potential of having logn/2 exceptions.