Nagarro Software interview experience Real time questions & tips from candidates to crack your interview

SDE - 1

Nagarro Software
upvote
share-icon
2 rounds | 3 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: Data Structures, Pointers, OOPS, Algorithms, Dynamic Programming, My SQL, Database, Operating System
Tip
Tip

Tip 1 : Must do Previously asked Interviews Questions.
Tip 2 : Prepare OS, DBMS, OOPs, Computer Networks well.
Tip 3 : Prepare well for one project mentioned in the resume, the interviewer may ask any question related to the project, especially about the networking part of the project.

Application process
Where: Referral
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at least 2 good projects mentioned in your resume with a link
Tip 2 : Focus on skills, internships, projects, and experiences.
Tip 3 : Make it simple, crisp, and one page

Interview rounds

01
Round
Medium
Online Coding Interview
Duration60 Minutes
Interview date23 Jun 2022
Coding problem1

This was an online test held on the mettl platform consists of 30 MCQs questions and 1 coding questions

1. Maximum Product Subarray

Moderate
25m average time
75% success
0/80
Asked in companies
InnovaccerAmazonMicrosoft

You are given an array “arr'' of integers. Your task is to find the contiguous subarray within the array which has the largest product of its elements. You have to report this maximum product.

An array c is a subarray of array d if c can be obtained from d by deletion of several elements from the beginning and several elements from the end.

For e.g.- The non-empty subarrays of an array [1,2,3] will be- [1],[2],[3],[1,2],[2,3],[1,2,3]. 
For Example:
If arr = {-3,4,5}.
All the possible non-empty contiguous subarrays of “arr” are {-3}, {4}, {5}, {-3,4}, {4,5} and {-3,4,5}.
The product of these subarrays are -3, 4, 5, -12, 20 and -60 respectively.
The maximum product is 20. Hence, the answer is 20.
Follow Up:
Can you solve this in linear time and constant space complexity?
Problem approach

A divide and conquer approach to solving the problem. The problem is a variation of the divide and conquer approach used to solve the "Maximum Subarray" problem. In addition to keeping track of the maximum positive product the maximum negative product of the divided regions also needs to be computed, since the product of two negative numbers is positive.

'''

class Solution {

int max(int a, int b) {

return Math.max(a, b);
}

int maxCrossing(int[] A, int low, int mid, int high) {

// Compute max positive and negative products left of mid
int maxPL = Integer.MIN_VALUE;
int maxNL = Integer.MAX_VALUE;
int prod = 1;
for(int i = mid; i >= low; --i) {
prod = prod * A[i];
if(prod > maxPL) {
maxPL = prod;
}
if(prod < maxNL) {
maxNL = prod;
}
}

// Compute max positive and negative products right of mid
int maxPR = Integer.MIN_VALUE;
int maxNR = Integer.MAX_VALUE;
prod = 1;
for(int i = mid + 1; i <= high; ++i) {
prod = prod * A[i];
if(prod > maxPR) {
maxPR = prod;
}
if(prod < maxNR) {
maxNR = prod;
}
}

// Compute max positive product crossing mid
int maxProd = max(maxPR, maxPL);
maxProd = max(maxProd, maxPR * maxPL);
maxProd = max(maxProd, maxNR * maxNL);

return maxProd;
}

int maxSubArray(int[] A, int low, int high) {
int res = 0;
if(low == high) {
return A[low];
}
int mid = (low + high) / 2;
// Compute max product subarray left of mid
int maxL = maxSubArray(A, low, mid);
// Compute max product subarray right of mid
int maxR = maxSubArray(A, mid + 1, high);
// Compute max product subarray crossing mid
int max_cross = maxCrossing(A, low, mid, high);

// Return max of all products
res = max(maxL, maxR);
res = max(res, max_cross);

return res;
}

public int maxProduct(int[] nums) {

int n = nums.length;

return maxSubArray(nums, 0, n - 1);
}
}

Try solving now
02
Round
Easy
Video Call
Duration60 Minutes
Interview date25 Jun 2022
Coding problem2

This was technical round purely based on the problem solving taken by the SDE1 at Nagarro.

1. Find Peak Element

Easy
15m average time
85% success
0/40
Asked in companies
DunzoHikeAdobe

You are given an array 'arr' of length 'n'. Find the index(0-based) of a peak element in the array. If there are multiple peak numbers, return the index of any peak number.


Peak element is defined as that element that is greater than both of its neighbors. If 'arr[i]' is the peak element, 'arr[i - 1]' < 'arr[i]' and 'arr[i + 1]' < 'arr[i]'.


Assume 'arr[-1]' and 'arr[n]' as negative infinity.


Note:
1.  There are no 2 adjacent elements having same value (as mentioned in the constraints).
2.  Do not print anything, just return the index of the peak element (0 - indexed).
3. 'True'/'False' will be printed depending on whether your answer is correct or not.


Example:

Input: 'arr' = [1, 8, 1, 5, 3]

Output: 3

Explanation: There are two possible answers. Both 8 and 5 are peak elements, so the correct answers are their positions, 1 and 3.


Problem approach

an easy solution :-

int findPeakElement(vector& nums)
{
int n = nums.size();
if(n==1)
return 0;
if(nums[0]>=nums[1])
return 0;
if(nums[n-1]>=nums[n-2])
return n-1;
for(int i = 1; i<=n-1;i++)
{
if(nums[i]>=nums[i-1] && nums[i]>=nums[i+1])
return i;
}

return -1;
}

Try solving now

2. Number of Islands

Easy
0/40
Asked in companies
IBMDunzoMicrosoft

You have been given a non-empty grid consisting of only 0s and 1s. You have to find the number of islands in the given grid.

An island is a group of 1s (representing land) connected horizontally, vertically or diagonally. You can assume that all four edges of the grid are surrounded by 0s (representing water).

Problem approach

class Solution {
public:

int numIslands(vector>& grid) {
int m = grid.size(), n = grid[0].size();
int ans = 0;
for(int i=0;i>& grid){
if(i < 0 || i>= grid.size() || j < 0 || j>= grid[0].size() || grid[i][j] != '1')
return;

grid[i][j] = '0';
dfs(i+1,j,grid);
dfs(i,j+1,grid);
dfs(i,j-1,grid);
dfs(i-1,j,grid);
}
};

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
3 rounds | 3 problems
Interviewed by Nagarro Software
0 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Nagarro Software
937 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Nagarro Software
1222 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Nagarro Software
758 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
115097 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58238 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35147 views
7 comments
0 upvotes