CV presented via friend who works for the company. In less than a week was invited to the first of two interviews. Got a positive answer within a week and have the second interview in a few days. Interviewer was pleasant and after a short introduction about her job in the company asked several technical questions. The interview lasted ~1:40 hours.
Interview questions [2]
Question 1
Implement a Singleton. Now, implement it another way (with the data member initially equaling NULL). Next, if the system has several users, how will you prevent concurrent access and deal with two users entering the 'if' at once in the first call (while still NULL) resulting in more than one singleton instance? What will you add to the code and where? How will you deal the fact that your previous answer is irrelevant in the majority of cases when the member is no longer NULL? (Double-checked locking)
Assume several segments on the X axis - received any way you wish as two points (x1,x2) representing the beginning and end of each one. Not necessarily integers. Return the first coordinate where there are maximum coinciding segments. What is the complexity? Pseudo code and later detailed code.