Coding

You are given a sorted list of integers, but some of the values are marked as -1 which indicates that they are out of range. Can you implement a method to determine the length of the list without using any built-in functions, and taking advantage of the sorted nature of the list?

Data Scientist

Palantir Technologies

Uber

Spotify

Wayfair

IBM

Yahoo

Did you come across this question in an interview?

  • You are given a sorted list of integers, but some of the values are marked as -1 which indicates that they are out of range. Can you implement a method to determine the length of the list without using any built-in functions, and taking advantage of the sorted nature of the list?
  • Can you construct a function to calculate the length of a sorted integer list that contains -1 as placeholders for out-of-range values, without using built-ins?
  • How would you code a solution to ascertain the length of a sorted integer list interspersed with -1s indicating out-of-range entries, without default functions?
  • What algorithm could you write to evaluate the length of a sorted list, where -1 denotes an out-of-range value, and without using built-in operations?
  • How would you approach writing a method to count the elements of a sorted list with -1 as an out-of-range marker, without built-in methods?
  • Can you propose a manual method to determine a sorted list's size, considering -1 values as out-of-range, without direct function calls?
  • How can you manually calculate the length of a sorted list with -1 as an out-of-range signal, avoiding the use of built-in commands?
  • How would you design an algorithm to compute the length of a sorted list that includes -1 for out-of-range numbers, without using any built-ins?
  • How do you devise a technique to find the length of a sorted list with out-of-range values marked as -1, without employing built-in functions?

Interview question asked to Data Scientists interviewing at PagerDuty, Virta, Etsy and others: You are given a sorted list of integers, but some of the values are marked as -1 which indicates that they are out of range. Can you implement a method to determine the length of the list without using any built-in functions, and taking advantage of the sorted nature of the list?.