How do you find the missing integer in an array of range 1 to 100?
Answer»
During an interview, this question is often used to assess your knowledge of how programmers may manipulate or troubleshoot arrays. As the answer may depend on the exact elements or structure of the array, this question may also display your problem-solving abilities. In addition to showing your FLEXIBILITY and extensive knowledge, providing solutions to all situations can also impress the interviewer.
A missing integer can be found by CALCULATING the sum of the SERIES using this function: n (n + 1) / 2
This function will work only if the array doesn't contain any duplicates or is missing more than one number. If an array contains duplicate elements, you can SORT the array and determine whether there are two equal elements.