1) Given list of numbers which are sorted and have duplicates . find first occurrence of a number such that
A[i] = i . We had a discussion on this . HE asked me to write unit test cases.
code worked in case of no duplicates, duplicates which are smaller or greater than required element . His test case was like -100, -10, -20, 3, 3, 3, 3, 3, 3, 9 failed on my code
2) Again gave array searching question. Given an array of elements like follows
10, -20, 20, -20, 20, 30, 30, -30, -40, -50, -60, 70, 90 where this array is not sorted . If you take absolute of all the elements this array will appear sorted. Find the first occurrence of 20 in this array.
3) Implement queue using stacks. gave this one.
4) linked list with a cycle somewhere . find the point where cycle exists and length of the cycle.
Asked me to write production quality code. gave this one correct I feel.
Asked me language which I like the best. I said c++
Sort of c++ round as I have c++ exp. asked me to
1) virtual functions
2) const discussion. meaning of const int * p and int * const p etc
but one question was interesting in this discussion
int *const p = (int *)malloc (sizeof(int)*10) ;
he said will you ever be able to deallocate this memory since this is const?
3) shared_ptr question and how will you use them in case you have templates
3.1) discussion on template specialization in the above case.
1) Design a pen
the discussion was long . I didn’t understand what he was trying to get from me. I did make classes but he was not convinced.
Hr said will contact me.