Saturday, October 31, 2009

Nagarro Interview of Varun Bhatia

The technical coding test consisted of following questions. You had to write the codes in programming language of your choice or pseudo codes were also acceptable.

1) You had to find the third largest number in a given array
Input: arr = { 1,2,3,4,5,6,7,8,9,1,2,3,5,6}
Output: 7

2) You had to find the largest palindrome in the given string (remember to test for both even and off palindromes)

3) You had to sort alphanumeric strings and you had to sort them
Input: arr = { a1,b3,b21,c0,c5,b2,a21,}
Output: arr = { a1, a21, b2, b3, b21, c0, c5}
The assumption was given that only one character was present in the string which is followed by a number.

4) Given an array, you had to write a function which returns true if all numbers in the given range are present otherwise false.
Input: arr = {5,6,7,8,9}
Output: TRUE
Input: arr = {5,6,8,1,2,3,4}
Output: False

It has been a trend that you need to attempt all questions to clear Nagarro, otherwise you have to convince the interviewer that you knew the ans but you fell short of time. Try writing codes of all but if falling short of time, you can also go with pseudo codes. Also, if a better approach for an particular questions strikes you in the end, please write the pseudo code of it in the sheet provided so that interviewee is convinced that you did not thought of this approach with the help of any of your friends.

Also, while waiting for your chance to interview, discuss your approach with your friends and think of any optimization possible to it. Also, discuss about the negative points of your approach so that you have something in your mind f interviewee asks this. Also, think of a better approach if possible.

The 2nd written paper consisted of maths and aptitude section. The sample paper is given in placement material. Practice it well because many questions often repeat from that sample paper and it saves time or other questions. Also, the cutoff in the written test is 60%. so you have to perform better than that. Good scoring in written test is often accounted well by Nagarro.

The technical interview consisted thorough discussion of solutions written by me and the optimization possible it. Also, interviewer will always ask if you can think of a better/alternative approach if you have not provided the best one. Do not shy if your answer is not the most optimized. Also, do not try to discuss the algo written by your friend because it might be thought as cheating.

The remaining questions are as follows:
1. Malloc a 2-D array. their are two approaches possible. I told both and he then discussed pros and cons of both approaches.

2. Add two octal numbers without using base conversion.

3. He asked to think of algo to rotate a matrix by 90 degrees. I gave an approach using transpose. Then he asked to think of an approach without using transpose. I could not think and finally he told me the approach. Then, he asked me to think, how to rotate matrices by 180,270,360 degrees. I told him a approach specific for a particular angle. Then, he gave a better approach and asked me to think of an approach with similar code for all angles and not specific to a particular angle. Fortunately, I was able to think of an approach.

4. He asked to discuss an algo to generate permutations and combination of a string.

That was all. My interviewee was not interested in syntax of C/C++. he was rather interested in discussing the algos, their complexity and various optimizations possible to it. He seemed to checking my problem solving strategy.

No comments:

Post a Comment