Bloomberg L.P. Interview Question: You are given a linked list t... | Glassdoor

Interview Question

Financial Software Developer Interview(Student Candidate)

You are given a linked list that originally had numbers

  1-100. One number is missing. How do you find the missing number?
Answer

Interview Answer

1 Answer

0

Classic, sum all the numbers in the list and deduct from the sum of numbers 1..100. Runtime O(N), space O(1).

There is even a formula to calculate the expected sum - summation of arithmetic series, S=100*(100+1)/2=5050.

Anonymous on Aug 31, 2016

Add Answers or Comments

To comment on this, Sign In or Sign Up.