i
Nagarro
Filter interviews by
I was interviewed in Sep 2021.
Round duration - 180 Minutes
Round difficulty - Medium
Given the schedule of N meetings with their start time Start[i]
and end time End[i]
, you need to determine which meetings can be organized in a single meeting room such ...
Given N meetings with start and end times, find the maximum number of meetings that can be organized in a single room without overlap.
Sort the meetings based on their end times.
Iterate through the sorted meetings and select the next meeting that does not overlap with the current meeting.
Keep track of the selected meetings and return their indices in the order they are organized.
Determine whether it is possible to partition an array ARR
into K
subsets, each having an equal sum.
ARR = [3, 5, 2, 4, 4], K = 2
tr...
Yes, it is possible to partition an array into K subsets with equal sum.
Check if the total sum of the array is divisible by K.
Use backtracking to try all possible combinations of subsets.
Keep track of visited elements to avoid repetition.
Example: ARR = [3, 5, 2, 4, 4], K = 2. Possible subsets: [4, 5] and [2, 3, 4].
You are provided with 'K' sorted linked lists, each sorted in increasing order. Your task is to merge all these lists into one single sorted linked list and return the head of ...
Merge k sorted linked lists into one single sorted linked list.
Create a min-heap to store the heads of all k linked lists.
Pop the smallest element from the heap and add it to the result list.
If the popped element has a next element, push it back to the heap.
Repeat until the heap is empty and return the merged sorted list.
You are given a doubly linked list with 'N' nodes, where each node can deviate at most 'K' positions from its actual position in the sorted list. You...
Sort a doubly linked list with nodes that can deviate at most K positions from their actual position in the sorted list.
Iterate through the doubly linked list and maintain a window of size K+1 to sort the elements within the window.
Use insertion sort within the window to sort the elements efficiently.
Repeat the process until the entire list is sorted.
Time complexity can be optimized to O(N*log(K)) using a priority queu
Given a binary tree, return the root values of all duplicate subtrees. Two subtrees are considered duplicate if they have the same structure with identical node values...
Find root values of duplicate subtrees in a binary tree.
Traverse the tree in a bottom-up manner to identify duplicate subtrees.
Use a hashmap to store the subtree structure and count occurrences.
Return the root values of duplicate subtrees found.
Handle null nodes by using -1 in the input sequence.
Round duration - 25 Minutes
Round difficulty - Medium
Keys in database management systems are unique identifiers for rows in a table.
Keys are used to uniquely identify each record in a table.
Primary key is a unique identifier for a record in a table.
Foreign key is a field in one table that refers to the primary key in another table.
Composite key is a combination of multiple columns that uniquely identify a record.
Unique key ensures that all values in a column are unique.
Round duration - 15 Minutes
Round difficulty - Easy
Tip 1 : Practice data structures vigorously
Tip 2 : Do at least 3 projects
Tip 3 : Practice Atleast 250 Questions
Tip 1 : Have some projects on resume.
Tip 2 : Do not put false things on resume
I was interviewed in Sep 2021.
Round duration - 240 Minutes
Round difficulty - Medium
Aptitude questions + 3 medium level Coding Problem + 2 hard level Coding problem
Given a square chessboard of size N x N
, you need to determine the minimum number of steps a Knight takes to reach a target position from its starting position.
Find the minimum number of steps a Knight takes to reach a target position on a chessboard.
Use BFS algorithm to find the shortest path from knight's starting position to target position.
Consider all possible moves of the knight on the chessboard.
Keep track of visited positions to avoid revisiting them.
Return the minimum number of steps required to reach the target position.
You are given a singly linked list of integers along with a positive integer 'K'. The task is to modify the linked list by reversing every alternate 'K' nodes o...
Reverse every alternate K nodes in a singly linked list
Traverse the linked list and reverse every alternate K nodes
Handle cases where the number of nodes left is less than K
Ensure to properly link the reversed nodes back to the original list
Given an array arr
of size 'N' and an integer 'K', determine the maximum subset sum of the array that does not exceed 'K'.
arr = [1, 3, 5, 9], K = 16
Find the maximum subset sum of an array that does not exceed a given integer K.
Use dynamic programming to solve this problem efficiently.
Iterate through all possible subsets of the array and keep track of the maximum sum that does not exceed K.
Consider the choice of including or excluding each element in the subset.
Optimize the solution by using memoization to avoid redundant calculations.
A thief is planning to rob a store and can carry a maximum weight of 'W' in his knapsack. The store contains 'N' items where the ith item has a weight of 'wi' and a value of...
Yes, the 0/1 Knapsack problem can be solved using dynamic programming with a space complexity of not more than O(W).
Use a 1D array to store the maximum value that can be stolen for each weight from 0 to W.
Iterate through the items and update the array based on whether including the current item would increase the total value.
The final element of the array will contain the maximum value that can be stolen within the wei
Given an array of strings A
of size N
, determine the longest complete string. A string is deemed complete if every prefix of the string also appears in the array. If mult...
Given an array of strings, find the longest complete string where every prefix of the string also appears in the array.
Iterate through each string in the array and check if all its prefixes exist in the array.
Keep track of the longest complete string found so far, and return the lexicographically smallest one if multiple exist.
If no complete string is found, return 'None'.
Round duration - 30 minutes
Round difficulty - Easy
The interviewer asked me questions from DS algo. Questions were like tell me the time complexity of this code. I was also asked questions from my projects and some questions from DBMS.
2 coding questions were given to me to solve
You are tasked with finding the total number of derangements for a given set of elements. Specifically, for an integer N
, determine how many ways there are to permute ...
Count the total number of derangements for a given set of elements.
A derangement is a permutation where no element appears in its original position.
Use the formula for derangements: !n = n! * (1 - 1/1! + 1/2! - 1/3! + ... + (-1)^n/n!).
Calculate the derangements modulo 10^9 + 7 to handle large numbers efficiently.
Two players 'X' and 'Y' are participating in a coin game. Starting with 'N' coins, players alternate turns, with 'X' starting first. On each turn, a player has three cho...
Determine the winner of a coin game where players take turns picking coins optimally.
Players take turns picking 'A', 'B', or 1 coin each turn
The player unable to make a move loses
Implement a function to determine the winner based on the given inputs
Tip 1 : Practice At least 250 Questions of DS algo
Tip 2 : Do at least 2 application based projects
Tip 3 : Practice questions with optimized approaches
Tip 1 : Have some applicayion based projects on resume.
Tip 2 : Do not put false things on resume.
Tip 3 : Project should clear and crisp
I was interviewed before Apr 2023.
Solid design principles are fundamental guidelines for designing software that are focused on maintainability, scalability, and reusability.
Solid design principles include Single Responsibility Principle, Open/Closed Principle, Liskov Substitution Principle, Interface Segregation Principle, and Dependency Inversion Principle.
These principles help in creating software that is easier to maintain, extend, and test.
For exa...
What people are saying about Nagarro
I was interviewed in Sep 2021.
Round duration - 180 minutes
Round difficulty - Medium
There were total 4 coding questions
1 -> Backtracking
2 -> Recursion
3 -> Greedy
4- > Graphs
In this problem, you are provided with a graph consisting of 'N' nodes and 'M' unidirectional edges. Additionally, two integers 'S' and 'D' are given, representing the so...
The task is to find all unique paths from a source node to a destination node in a graph.
Identify all unique paths from source node to destination node in a graph
Ensure all nodes in the path are unique
Output total number of valid paths and list nodes in each path in lexicographical order
Given the schedule of N meetings with their start time Start[i]
and end time End[i]
, you need to determine which meetings can be organized in a single meeting room such ...
Given N meetings with start and end times, find the maximum number of meetings that can be organized in a single room without overlap.
Sort the meetings based on their end times.
Iterate through the sorted meetings and select the next meeting that does not overlap with the current meeting.
Keep track of the selected meetings and return their indices in the order they are organized.
A thief is planning to rob a store and can carry a maximum weight 'W' in their knapsack. The store contains 'N' items, each with a known weight and value. Given these constr...
The 0/1 Knapsack Problem involves maximizing profit by selecting items with known weights and values to fit within a knapsack of limited capacity.
Create a 2D array to store the maximum profit that can be achieved for each item and weight combination.
Use dynamic programming to iteratively fill the knapsack with items, considering whether to include each item or not.
The final value in the 2D array will represent the maxi...
You are provided with a 2-dimensional matrix having N
rows and M
columns, containing only 1s (land) and 0s (water). Your goal is to determine the number of islands in t...
Count the number of islands in a 2D matrix of 1s and 0s.
Use depth-first search (DFS) to traverse the matrix and identify connected groups of 1s.
Maintain a visited array to keep track of visited cells to avoid redundant traversal.
Increment the island count each time a new island is encountered.
Consider all eight possible directions for connectivity while traversing the matrix.
Handle edge cases such as out of bounds indi
Round duration - 45 minutes
Round difficulty - Medium
there were total 2 coding questions asked
one was from 2 pointer and another was from Binary Tree
Given an array ARR
consisting of N
integers, rearrange the elements such that all negative numbers are located before all positive numbers. The orde...
Yes, this can be achieved by using the two-pointer approach to rearrange the array in-place with O(1) auxiliary space.
Use two pointers, one starting from the beginning and one from the end of the array.
Swap elements at the two pointers if they are not in the correct order (negative before positive).
Continue this process until the two pointers meet in the middle of the array.
Given a non-empty binary tree where each node has a non-negative integer value, determine the maximum possible sum of the path between any two leaves of the given tree.
...Find the maximum path sum between two leaf nodes in a binary tree.
Traverse the tree to find the maximum path sum between two leaf nodes
Keep track of the maximum sum as you traverse the tree
Consider all possible paths that pass through the root and those that do not
Handle cases where there is only one leaf node in the tree
Tip 1 : Do DSA
Tip 2 : Do Extra Subjects
Tip 3 : Prepare some Projects
Tip 1 : Do Mention coding profiles in resume
Tip 2 : Do add summary of Projects
Nagarro interview questions for designations
I was interviewed in Aug 2021.
Round duration - 150 Minutes
Round difficulty - Medium
It was an Aptitude test and Technical objective test of 60 minutes followed by a Coding test of 90 minutes.There was a 1 hour gap b/w the two tests.
Ninja needs to perform basic string compression. For any character that repeats consecutively more than once, replace the repeated sequence with the character followed...
Implement a function to compress a string by replacing consecutive characters with the character followed by the count of repetitions.
Iterate through the input string and keep track of consecutive characters and their counts.
Replace consecutive characters with the character followed by the count of repetitions if count is greater than 1.
Return the compressed string as output.
Given a binary tree where each node contains an integer value, and a value 'K', your task is to find all the paths in the binary tree such that the sum of the node values in ...
Find all paths in a binary tree with nodes summing up to a given value K.
Traverse the binary tree and keep track of the current path and its sum.
At each node, check if the sum equals K and store the path if true.
Recursively explore left and right subtrees while updating the path and sum.
Return the list of paths that sum up to K in the binary tree.
Given an array of integers with 'N' elements, determine the length of the longest subsequence where each element is greater than the previous element. This...
Find the length of the longest strictly increasing subsequence in an array of integers.
Use dynamic programming to solve this problem efficiently.
Initialize an array to store the length of the longest increasing subsequence ending at each index.
Iterate through the array and update the length of the longest increasing subsequence for each element.
Return the maximum value in the array as the result.
Round duration - 45 Minutes
Round difficulty - Medium
This was also a Data Structures and Algorithms round where I was asked to solve 2 coding problems explaining my approach with proper Complexity Analysis . After the coding questions were over there was some time left so the interviewer asked me some concepts related to DBMS.
You are given a long type array/list ARR
of size N
, representing an elevation map. The value ARR[i]
denotes the elevation of the ith
bar. Your task is to determine th...
Calculate the total amount of rainwater that can be trapped between given elevations in an array.
Iterate through the array and calculate the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped at each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water at each bar to get the total trapped water for the entire array.
You are given a permutation of 'N' integers. A sequence of 'N' integers is considered a permutation if it includes all integers from 1 to 'N' exactly once. Your task is ...
Given a permutation of 'N' integers, rearrange the numbers to form the lexicographically next greater permutation.
Iterate from right to left to find the first element that is smaller than the element to its right.
Swap this element with the smallest element to its right that is greater than it.
Reverse the elements to the right of the swapped element to get the lexicographically next greater permutation.
If no such elemen...
Indexing in databases is a technique used to improve the speed of data retrieval by creating a data structure that allows for quick lookups.
Indexes are created on columns in a database table to speed up the retrieval of rows that match a certain condition.
Types of indexes include B-tree, hash, and bitmap indexes.
Indexes can improve the performance of SELECT queries but may slow down INSERT, UPDATE, and DELETE operation...
Round duration - 45 Minutes
Round difficulty - Medium
This round was also held on Google Meet where I was supposed to code 2 problems in a Google Doc. After the coding questions , I was asked some core concepts related to OS .
Given an array of integers ARR
of length N
and an integer Target
, your task is to return all pairs of elements such that they add up to the Target
.
The first line ...
Given an array of integers and a target, find all pairs of elements that add up to the target.
Iterate through the array and for each element, check if the target minus the element exists in a hash set.
If it exists, add the pair to the result. If not, add the element to the hash set.
Handle cases where the same element is used twice to form a pair.
Return (-1, -1) if no pair is found.
Convert a given string 'S' into its equivalent representation based on a mobile numeric keypad sequence. Using the keypad layout shown in the reference, output the seque...
Convert a given string into its equivalent representation based on a mobile numeric keypad sequence.
Iterate through each character in the input string and map it to its corresponding numeric keypad sequence.
Use a dictionary to store the mapping of characters to numeric sequences.
Handle lowercase characters only and ignore special characters, capital letters, and spaces.
FCFS stands for First-Come, First-Served. It is a scheduling algorithm where tasks are executed in the order they arrive.
FCFS is a non-preemptive scheduling algorithm.
Tasks are executed in the order they arrive in the queue.
It is simple to understand and implement.
Example: Consider a printer queue where print jobs are processed in the order they are submitted.
Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
Get interview-ready with Top Nagarro Interview Questions
I was interviewed in Jul 2021.
Round duration - 150 Minutes
Round difficulty - Medium
It was an Aptitude test and Technical objective test of 60 minutes followed by a Coding test of 90 minutes.There was a 1 hour gap b/w the two tests.
You are provided with a number of stairs, and initially, you are located at the 0th stair. You need to reach the Nth stair, and you can climb one or tw...
The problem involves finding the number of distinct ways to climb to the Nth stair by climbing one or two steps at a time.
Use dynamic programming to solve the problem efficiently.
The number of ways to reach the Nth stair is the sum of the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Handle base cases for N=0 and N=1 separately.
Implement modulo operation to avoid overflow while calculating the result.
...
Given an array Arr
consisting of N integers, your task is to find the equilibrium index of the array.
An index is considered as an equilibrium index if the sum of elem...
Find the equilibrium index of an array where sum of elements on left equals sum on right.
Iterate through array to calculate prefix and suffix sums
Compare prefix and suffix sums to find equilibrium index
Return -1 if no equilibrium index is found
Given a positive integer 'N', determine the perfect square number closest to 'N' and the number of steps required to reach that perfect square.
...
Given a positive integer 'N', find the closest perfect square number and the steps required to reach it.
Find the square root of N and round it to the nearest integer to get the closest perfect square.
Calculate the difference between the closest perfect square and N to get the number of steps required.
Return the closest perfect square and the number of steps as output.
Round duration - 45 Minutes
Round difficulty - Medium
This round had 2 questions where I had to first explain my approach with proper complexity analysis and then write the pseudo code for the same.
Given a string ‘S’ composed of lowercase English letters, your task is to identify the longest palindromic substring within ‘S’.
If there are multiple longest palin...
Find the longest palindromic substring in a given string, returning the rightmost one if multiple exist.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found and its starting index
Return the substring starting from the index of the longest palindrome found
Given a binary tree with N
nodes, determine whether the tree is a Binary Search Tree (BST). If it is a BST, return true
; otherwise, return false
.
A binary search tree (BST)...
Validate if a given binary tree is a Binary Search Tree (BST) or not.
Check if the left subtree of a node contains only nodes with data less than the node's data.
Check if the right subtree of a node contains only nodes with data greater than the node's data.
Recursively check if both the left and right subtrees are also binary search trees.
Use level order traversal to construct the binary tree from input data.
Round duration - 50 Minutes
Round difficulty - Medium
This round also had 2 questions from DS/Algo which were followed by some questions from DBMS and SQL.
Given a positive integer n
, your task is to determine the next smallest integer and the previous largest integer that have the same number of '1' bits in t...
Given a positive integer, find the next smallest and previous largest integers with the same number of set bits in their binary representation.
Count the number of set bits in the binary representation of the given integer 'n'.
Find the next smallest integer by iterating from 'n+1' onwards and checking for the same number of set bits.
Find the previous largest integer by iterating from 'n-1' downwards and checking for the
Given an array ARR
of size 'N', where each integer is in the range from 0 to N - 1, identify all elements that appear more than once.
Return the duplicate elements in any orde...
Find duplicates in an array of integers within a specified range.
Iterate through the array and keep track of the count of each element using a hashmap.
Return elements with count greater than 1 as duplicates.
Time complexity can be optimized to O(N) using a HashSet to store seen elements.
Views in a database management system provide security, simplify complex queries, and improve performance.
Enhanced security by restricting access to certain columns or rows
Simplify complex queries by pre-defining joins and filters
Improve performance by storing frequently used queries as views
Reduce redundancy by storing common logic in views
Constraints in SQL are rules and restrictions applied to columns in a table to enforce data integrity.
Constraints ensure data accuracy and consistency in a database.
Common constraints include NOT NULL, UNIQUE, PRIMARY KEY, FOREIGN KEY, and CHECK constraints.
NOT NULL constraint ensures a column cannot have a NULL value.
UNIQUE constraint ensures all values in a column are unique.
PRIMARY KEY constraint uniquely identifies...
Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
OOPs is a programming paradigm based on the concept of objects, which can contain data and code.
OOPs stands for Object-Oriented Programming.
It focuses on creating objects that interact with each other to solve a problem.
It uses concepts like inheritance, encapsulation, and polymorphism.
Inheritance allows a class to inherit properties and methods from another class.
Encapsulation is the practice of hiding data and method...
Constructor and destructor are special member functions in a class that are used to initialize and destroy objects respectively.
Constructor is called when an object is created and is used to initialize the object's data members.
Destructor is called when an object is destroyed and is used to free up any resources that the object was using.
Constructor has the same name as the class and no return type, while destructor ha...
Polymorphism is the ability of an object to take on many forms.
Polymorphism allows objects of different classes to be treated as if they are of the same class.
It is achieved through method overriding and method overloading.
Example: A parent class Animal can have child classes like Dog, Cat, and Cow. All these child classes can have a method called 'makeSound', but each class can have a different implementation of the m...
I applied via Recruitment Consulltant and was interviewed before Apr 2021. There were 4 interview rounds.
Apti and Coding test...quite good level.
I was interviewed before May 2021.
Round duration - 90 Minutes
Round difficulty - Easy
This round was also conducted on Metll platform. This round is totally based on coding. There are so many choices in language, so you can easily select the language in which you are comfortable in. There are three problems to solve. I choose Java 8 to solve the problems. The problems are ranging from easy to hard-
To find the maximum occurring character in a given string.
To find the factorial of a given number.
Count Derangements.
Determine the number of derangements possible for a set of 'N' elements. A derangement is a permutation where no element appears in its original position.
An integer 'T' repres...
Count the number of derangements possible for a set of 'N' elements.
Derangements are permutations where no element appears in its original position.
Use the formula: !n = n! * (1 - 1/1! + 1/2! - 1/3! + ... + (-1)^n/n!).
Calculate the derangements modulo (10^9 + 7) for each test case.
Develop a program to compute the factorial of a given integer 'n'.
The factorial of a non-negative integer 'n', denoted as n!
, is the product of all positive integ...
Program to compute factorial of a given integer 'n', with error handling for negative values.
Create a function to calculate factorial using a loop or recursion
Check if input is negative, return 'Error' if true
Handle edge cases like 0 and 1 separately
Use long data type to handle large factorials
You are given two strings 'A' and 'B' composed of words separated by spaces. Your task is to determine the most frequent and lexicographically smallest word in string ...
Find the most frequent and lexicographically smallest word in string 'A' that is not present in string 'B'.
Split strings 'A' and 'B' into words
Count frequency of each word in 'A'
Check if word is not in 'B' and is the most frequent and lexicographically smallest
Return the word or -1 if no such word exists
Round duration - 90 Minutes
Round difficulty - Easy
The interviewer was so polite. He firstly asks me to describe myself and then ask about my family. After that he ask which language I choose to solve problems in Coding round and why I choose that language. Then he started to ask the technical questions.
Tip 1 : Practice questions on leetcode
Tip 2 : Understand the best solutions in depth and algorithm used
Tip 3 : Ask clarifying questions to the interviewer and break the problem to smaller sub parts
Tip 1 : Highlight your most impactful work on the resume
Tip 2 : Keep it easy to understand
Some of the top questions asked at the Nagarro Software Developer interview -
The duration of Nagarro Software Developer interview process can vary, but typically it takes about less than 2 weeks to complete.
based on 39 interviews
5 Interview rounds
based on 70 reviews
Rating in categories
Associate Staff Engineer
2.9k
salaries
| ₹0 L/yr - ₹0 L/yr |
Staff Engineer
2.9k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Engineer
2.4k
salaries
| ₹0 L/yr - ₹0 L/yr |
Senior Software Engineer
1.1k
salaries
| ₹0 L/yr - ₹0 L/yr |
Engineer
896
salaries
| ₹0 L/yr - ₹0 L/yr |
Deloitte
Cognizant
TCS
Accenture