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

SDE - 1

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

Interview preparation journey

expand-icon
Preparation
Duration: 6 Months
Topics: DSA , OOPS , OS, CN, Algorithms, DBMS , Dynamic Programming , Graphs
Tip
Tip

Tip 1 : Do DSA
Tip 2 : Do Extra Subjects
Tip 3 : Prepare some Projects

Application process
Where: Campus
Eligibility: 7
Resume Tip
Resume tip

Tip 1 : Do Mention coding profiles in resume
Tip 2 : Do add summary of Projects

Interview rounds

01
Round
Medium
Online Coding Test
Duration180 minutes
Interview date12 Aug 2021
Coding problem4

There were total 4 coding questions
1 -> Backtracking
2 -> Recursion
3 -> Greedy
4- > Graphs

Moderate
45m average time
55% success
0/80
Asked in companies
SalesforceNagarro Software

You are given a graph with ‘N’ nodes and ‘M’ unidirectional edges. Also you are given two integers ‘S’ and ‘D’ denoting the source and destination. Your task is to find all the paths from ‘S’ to ‘D’.

Note: An ordered set of nodes { S, u1, u2...un, D} is a valid path between ‘S’ and ‘D’, if all nodes along the path are unique.

For example:

For given N = 4, M = 4, S = 0 and D =3.

1

In the above example, the path 0 -> 1 - > 3 is a valid path as all nodes along the path are unique and the path 0 -> 1 -> 2 -> 1 -> 3 is not a valid path because node 1 is visited twice.
Problem approach

1. In this approach we will use BFS (breadth first search) to find all possible paths.

2. We will make a queue which contains the following information : 

a) Vector that stores the path up to a certain cell.

b) coordinates of the cell.

3. We will start from the top-left cell and push cell value and coordinates in the queue.

4. We will keep on exploring right and down cell (if possible) until queue is not empty 

and push them in the queue by updating the current cell vector.

5. If we reach the last cell then we have got one answer and we will print the answer vector.

Try solving now

2. Maximum meetings

Easy
10m average time
90% success
0/40
Asked in companies
AmazonMicrosoftMakeMyTrip

You are given the schedule of 'N' meetings with their start time 'Start[i]' and end time 'End[i]'.


You have only 1 meeting room. So, you need to return the maximum number of meetings you can organize.


Note:
The start time of one chosen meeting can’t be equal to the end time of the other chosen meeting.


For example:
'N' = 3, Start = [1, 3, 6], End = [4, 8, 7].

You can organize a maximum of 2 meetings. Meeting number 1 from 1 to 4, Meeting number 3 from 6 to 7.
Problem approach

Idea is to solve the problem using the greedy approach which is the same as Activity Selection Problem.

1. Sort all pairs(Meetings) in increasing order of second number(Finish time) of each pair.

2. Select first meeting of sorted pair as the first Meeting in the room and push it into result vector and set a variable time_limit with the second value(Finishing time) of the first selected meeting.

3. Iterate from the second pair to last pair of the array and if the value of the first element(Starting time of meeting) of the current pair is greater then previously selected pair finish time (time_limit) then select the current pair and update the result vector (push selected meeting number into vector) and variable time_limit.
.
4. Print the Order of meeting from vector.

Try solving now

3. 0 1 Knapsack

Moderate
0/80
Asked in companies
Disney + HotstarOptumAmazon

A thief is robbing a store and can carry a maximum weight of ‘W’ into his knapsack. There are 'N' items available in the store and the weight and value of each item is known to the thief. Considering the constraints of the maximum weight that a knapsack can carry, you have to find the maximum profit that a thief can generate by stealing items.

Note: The thief is not allowed to break the items.

For example, N = 4, W = 10 and the weights and values of items are weights = [6, 1, 5, 3] and values = [3, 6, 1, 4]. Then the best way to fill the knapsack is to choose items with weight 6, 1 and 3. The total value of knapsack = 3 + 6 + 4 = 13.

Problem approach

In the Dynamic programming we will work considering the same cases as mentioned in the recursive approach. In a DP[][] table let’s consider all the possible weights from ‘1’ to ‘W’ as the columns and weights that can be kept as the rows. 

The state DP[i][j] will denote maximum value of ‘j-weight’ considering all values from ‘1 to ith’. So if we consider ‘wi’ (weight in ‘ith’ row) we can fill it in all columns which have ‘weight values > wi’. Now two possibilities can take place: 

1. Fill ‘wi’ in the given column.

2. Do not fill ‘wi’ in the given column.

Now we have to take a maximum of these two possibilities, formally if we do not fill ‘ith’ weight in ‘jth’ column then DP[i][j] state will be same as DP[i-1][j] but if we fill the weight, DP[i][j] will be equal to the value of ‘wi’+ value of the column weighing ‘j-wi’ in the previous row. So we take the maximum of these two possibilities to fill the current state.

Try solving now

4. Find Number Of Islands

Moderate
34m average time
60% success
0/80
Asked in companies
WalmartShareChatAmazon

You are given a 2-dimensional array/list having N rows and M columns, which is filled with ones(1) and zeroes(0). 1 signifies land, and 0 signifies water.

A cell is said to be connected to another cell, if one cell lies immediately next to the other cell, in any of the eight directions (two vertical, two horizontal, and four diagonals).

A group of connected cells having value 1 is called an island. Your task is to find the number of such islands present in the matrix.

Problem approach

The problem can be easily solved by applying DFS() on each component. In each DFS() call, a component or a sub-graph is visited. We will call DFS on the next un-visited component. The number of calls to DFS() gives the number of connected components.

Try solving now
02
Round
Medium
Face to Face
Duration45 minutes
Interview date8 Sep 2021
Coding problem2

there were total 2 coding questions asked
one was from 2 pointer and another was from Binary Tree

1. Move All Negative Numbers To Beginning And Positive To End

Easy
10m average time
90% success
0/40
Asked in companies
BarclaysDunzoSAP Labs

You are given an array 'ARR' consisting of 'N' integers. You need to rearrange the array elements such that all negative numbers appear before all positive numbers.

Note:
The order of elements in the resulting array is not important.
Example:
Let the array be [1, 2, -3, 4, -4, -5]. On rearranging the array such that all negative numbers appear before all positive numbers we get the resulting array [-3, -5, -4, 2, 4, 1].
Problem approach

1. Check If the left and right pointer elements are negative then simply increment the left pointer.

2. Otherwise, if the left element is positive and the right element is negative then simply swap the elements, and simultaneously increment and decrement the left and right pointers.

3. Else if the left element is positive and the right element is also positive then simply decrement the right pointer.

4. Repeat the above 3 steps until the left pointer ≤ right pointer.

Try solving now

2. Maximum Path Sum Between Two Leaves

Hard
50m average time
35% success
0/120
Asked in companies
DirectiMicrosoftMathworks

You are given a non-empty binary tree where each node has a non-negative integer value. Return the maximum possible sum of path between any two leaves of the given tree.

The path is also inclusive of the leaf nodes and the maximum path sum may or may not go through the root of the given tree.

If there is only one leaf node in the tree, then return -1.

Problem approach

For each node there can be four ways that the max path goes through the node: 
1. Node only 
2. Max path through Left Child + Node 
3. Max path through Right Child + Node 
4. Max path through Left Child + Node + Max path through Right Child
The idea is to keep trace of four paths and pick up the max one in the end. An important thing to note is, root of every subtree need to return maximum path sum such that at most one child of root is involved. This is needed for parent function call. In below code, this sum is stored in ‘max_single’ and returned by the recursive function.

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
936 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Nagarro Software
1221 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
58237 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35147 views
7 comments
0 upvotes