# Nagarro Interview Experience | Set 4 (Off-Campus)

• Difficulty Level : Medium
• Last Updated : 02 May, 2017

Written Round:

Paper 1 (20 minutes)
The questions were based on C programming language it consisted of basic output questions. There was 2.5 for correct answer and -1/4 for incorrect answer. Going through test your C skills or any other book is sufficient. This paper was easy.

Paper 2 (40 minutes)
The paper has two sections. The questions were from speed and distance, profit and loss, allegation, ratio and proportion, pipes and cisterns, geometry and mensuration etc. Second section was based on Logical Ability. The questions were based on coding and decoding, clocks, missing number from a pattern etc. This paper was quite difficult.

Subjective Coding Round:

This round was for 75 minutes and there were three questions which have to be coded using any programming language. First question was given an unsorted array find the Fourth largest in it O(n) time complexity. Second was given and array of 0’s and 1’s sort the array in O(n). Third question was given a string find the longest substring having at most 2 unique characters, if there are multiple longest substrings return them all. Ex: given string “helloworld” then output should contain { “ell”,“llo”,“owo”}. First two questions were quite easy the last one I did with brute force method and there was no time constraint so I did it in O(n2) time.

After that there was a lunch break and after that they announced the names of people shortlisted for technical interviews.

Technical Round:

The interviewer asked me to explain each of my code. He started with the sort 0’s and 1’s and asked me how is it O(n), I explained him. Then he made it complex by saying that if there are numbers from 0 to k in an array of size n then how will you sort them in O(n), I told him the count sort, he agreed with it and then asked me to quickly write down the code, I wrote it down, there was a silly mistake which he pointed out and said that it’s good and then moved on to next problem. He saw my code for fourth largest in an array, I did it using heap and time for creating heap is O(nlogn) then he checked the code which was perfectly fine. He then gave me a hint and asked me to do it in O(n) using something from quicksort. I told him that we can do it using partition algorithm of quicksort and explained him that. He then moved on to finding longest substring having at most 2 unique characters, he asked me to improve the time complexity I explained him that I tried doing it using DP but I’m not able to do it for strings having length more than three, I told him that it seemed to be a variation of longest palindromic substring. I explained my code to him he liked the way I used an integer to mark the presence of characters in string. He then pointed some small mistakes and then for finishing interview asked me the difference between ++i and i++. Results were declared and I was selected for the HR round.

HR Round: