i
Nagarro
Filter interviews by
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
Ai...
Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.
Use Floyd's Cycle Detection Algorithm to identify the loop in the linked list.
Once the loop is detected, use two pointers to find the start of the loop.
Adjust the pointers to remove the loop and return the modified linked list.
You are given an array ARR
of long type, which represents an elevation map where ARR[i]
denotes the elevation of the ith
bar. Calculate the total amount of rainwater th...
Calculate the total amount of rainwater that can be trapped within given elevation map.
Iterate through the array to find the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped above each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water above each bar to get the total trapped water for the elevation map.
Given a binary tree with N
nodes, your task is to output the Spiral Order traversal of the binary tree.
The input consists of a single line containing eleme...
The task is to output the Spiral Order traversal of a binary tree given in level order.
Implement a function that returns the spiral order traversal as a list
Traverse the binary tree in a spiral order alternating between left to right and right to left
Use a queue to keep track of nodes at each level
Handle null nodes represented by -1 in the input
Determine if the second string STR2
can be constructed using characters from the first string STR1
. Both strings may include any characters.
The first line contains an in...
Check if second string can be formed using characters from the first string.
Iterate through each character in STR2 and check if it exists in STR1.
Use a hashmap to store the frequency of characters in STR1 for efficient lookup.
Return 'YES' if all characters in STR2 are found in STR1, otherwise return 'NO'.
What people are saying about Nagarro
A derangement is a permutation of 'N' elements, where no element appears in its original position. For instance, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0} because each ele...
Count the total number of derangements possible for a set of 'N' 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!)
Return the answer modulo (10^9 + 7) to handle large results.
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exac...
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers
A prime number has exactly two distinct positive divisors: 1 and itself
Implement a function to find the Nth prime number based on the given input
You are given a positive integer N
. Your task is to find the perfect square number that is closest to N
and determine the number of steps required to reach...
Find the closest perfect square to a given positive integer and determine the number of steps required to reach that number.
Iterate through perfect squares starting from 1 until the square is greater than the given number
Calculate the distance between the perfect square and the given number
Return the closest perfect square and the distance as output
Explanation: Sanyam wishes to distribute 'N' candies among 'K' friends. The friends are arranged based on Sanyam's order of likeness. He initially distributes candies su...
Distribute N candies among K people in Sanyam's order of likeness, incrementing distribution by K each round until all candies are distributed.
Distribute candies starting from 1st friend, incrementing by K each round
If remaining candies are fewer than what a friend is supposed to receive, stop distribution
Output the number of candies each friend ends up with at the end of distribution
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you m...
Reverse a given stack of integers using recursion without extra space or loop constructs.
Use recursion to pop all elements from the original stack and store them in function call stack.
Once the stack is empty, push the elements back in reverse order using recursion.
Ensure to handle base cases for empty stack or single element stack.
Example: If the input stack is [1, 2, 3], after reversal it should be [3, 2, 1].
Given a string 'S' consisting of words, your task is to determine the number of palindrome words within 'S'. A word is considered a palindrome if it reads the same backwa...
Count the number of palindrome words in a given string.
Split the string into words using whitespace as delimiter.
Check each word if it is a palindrome by comparing it with its reverse.
Increment a counter for each palindrome word found.
Output the total count of palindrome words for each test case.
I appeared for an interview in Jan 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. The round started at 2:00 PM. Candidates who cleared this round were shortlisted for the next round.
Your task is to determine the maximum possible sum of a simple path between any two nodes (possibly the same) in a given binary tree of 'N' nodes with integer values.
Find the maximum sum of a simple path between any two nodes in a binary tree.
Use a recursive approach to traverse the binary tree and calculate the maximum sum path.
Keep track of the maximum sum path found so far while traversing the tree.
Consider negative values in the path sum calculation to handle cases where the path can start and end at different nodes.
Handle cases where the path can go through the root node or no...
Round duration - 30 minutes
Round difficulty - Medium
This was the technical interview round it started at 12:00 pm, here we were asked to explain the codes we wrote in the coding test and after that, we were given a coding problem for which we needed to write a pseudocode solution and explain it to the interviewer. The interviewer was quite polite and understanding even if we got stuck while writing the code he didn't rush the interview. Candidates who cleared this round were shortlisted for the HR round.
You have a simple undirected graph G = (V, E)
where each edge has a distinct weight. Consider an edge e
as part of this graph. Determine which of the given stateme...
In an undirected graph with distinct edge weights, the lightest edge in a cycle is included in every MST, while the heaviest edge is excluded.
The lightest edge in a cycle is always included in every MST of the graph.
The heaviest edge in a cycle is always excluded from every MST of the graph.
This property holds true for all simple undirected graphs with distinct edge weights.
Round duration - 20 minutes
Round difficulty - Medium
This round started at 4:00 pm, it was also conducted on Microsoft Teams. In this round, we were asked the basic HR questions.
Basically, the interviewer just wanted to test our confidence and communication skills.
In this problem, you have ‘n’ carrots lined up and denoted by numbers 1 through ‘n’. There are ‘k’ rabbits, and each rabbit can jump to carrots that are multiples of its uni...
Calculate uneaten carrots after rabbits jump based on their unique factors.
Iterate through each rabbit's jumping factor and mark the carrots they land on as eaten
Calculate the remaining uneaten carrots by counting the ones not marked as eaten
Consider using a data structure like an array to keep track of eaten carrots efficiently
Tip 1 : Practice at least 100 aptitude questions a week
Tip 2 : Practice coding questions on coding platforms like coding ninjas codestudio, Geeksforgeeks, HackerEarth, etc.
Tip 3 : Prepare for the interview questions
Tip 1 : The format of your resume should look professional
Tip 2 : Only put those skills in your resume on which you are confident
Tip 3 : Do mention all the projects or internships you have done
Tip 4: Do not put false things on your resume.
I appeared for an interview in Jan 2021.
Round duration - 30 minutes
Round difficulty - Medium
This round consists of technical interview.
The interviewer ask questions related to the 3 coding problems given in previous round i.e.de-bug the code and explain the time and space complexity.
In last they give one problem of nearest square integer and want the optimized solution only.
The students selected in this round are shortlisted for next round.
You are given a positive integer N
. Your task is to find the perfect square number that is closest to N
and determine the number of steps required to reac...
Find the closest perfect square to a given positive integer and determine the number of steps required to reach that number.
Iterate through perfect squares starting from 1 until the square is greater than the given number
Calculate the distance between the perfect square and the given number
Return the closest perfect square and the distance as output
Tip 1 : Practice aptitude questions according to previous year asked questions.
Tip 2 : Practice 5-10 new DSA problem per day.
Tip 3 : Practice 1-2 hard level DSA problem per day.
Tip 4 : For DBMS,OOPS and SQL give 1 week for each.
Tip 1 : Make 1-2 project according to your skills section.
Tip 2 : Write only those skills in which you are confident of.
Tip 3 : Always update your resume.
I appeared for an interview in Oct 2020.
Round duration - 90 minutes
Round difficulty - Medium
Timing Morning
Environment Online
3 Coding Questions were asked
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 determining the number of distinct ways to climb from the 0th to the Nth stair by climbing one or two steps at a time.
Use dynamic programming to solve this problem efficiently.
The number of ways to reach the Nth stair can be calculated by adding the number of ways to reach the (N-1)th stair and the (N-2)th stair.
Consider base cases where N=0 and N=1 separately.
Handle large values of N by using modu...
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exa...
To find the Nth prime number given a number N, implement a function that returns the Nth prime number.
Create a function that takes N as input and returns the Nth prime number.
Iterate through numbers starting from 2 and check if each number is prime.
Keep track of the count of prime numbers found until reaching the Nth prime number.
Return the Nth prime number once it is found.
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 for each test case.
Round duration - 40 minutes
Round difficulty - Medium
Timing Morning
Environment Online
Interviewer was very supportive during the Interview
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 ...
The task is to find all pairs of elements in an array that add up to a given 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.
Print the pairs found or (-1, -1) if no pair is found.
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.
Given a binary tree with N
nodes, your task is to output the Spiral Order traversal of the binary tree.
The input consists of a single line containing elem...
The task is to output the Spiral Order traversal of a binary tree given in level order.
Implement a function that returns the spiral order traversal as a list
Traverse the binary tree in a spiral order, alternating between left to right and right to left
Use a queue to keep track of nodes at each level
Handle null nodes appropriately in the traversal
Example: Input: 1 2 3 -1 -1 4 5, Output: 1 3 2 4 5
Round duration - 20 minutes
Round difficulty - Easy
Timing Morning
Environment Online
Interviewer was friendly
Tip 1 : Keep Practicing Ds and Algorithm questions on regular basis.
Tip 2 : Make resume short, simple and to the point.
Tip 3 : Be regular on coding platforms and participate in coding contest.
Tip 4 : Revise Theoretical topics such as computer networks, operating systems etc.
Tip 1 : Add skills and technologies you are confident with.
Tip 2 : Make resume simple and precise
Tip 3 : Go through the projects you have mentioned in the resume.
Tip 4 : Go through the resume before the interview.
I appeared for an interview in Oct 2020.
Round duration - 90 minutes
Round difficulty - Easy
Timing: Morning (10 AM)
Environment: Online (Proctored)
Coding Round (3 Questions)
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exa...
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers
A prime number has exactly two distinct positive divisors: 1 and itself
Implement a function to find the Nth prime number based on the given input
Determine if the second string STR2
can be constructed using characters from the first string STR1
. Both strings may include any characters.
The first line contains an i...
Check if second string can be formed using characters from the first string.
Iterate through each character in STR2 and check if it exists in STR1.
Use a hashmap to store the frequency of characters in STR1 for efficient lookup.
Return 'YES' if all characters in STR2 are found in STR1, otherwise return 'NO'.
A derangement is a permutation of 'N' elements, where no element appears in its original position. For instance, a derangement of {0, 1, 2, 3} is {2, 3, 1, 0} because each el...
Count the total number of derangements possible for a set of 'N' 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!)
Return the answer modulo (10^9 + 7) to handle large results.
Round duration - 40 minutes
Round difficulty - Medium
Timing: 10:00 AM
Environment: Online (Webcam + Mic on)
The interviewer was friendly and to the point.
For a given singly linked list, identify if a loop exists and remove it, adjusting the linked list in place. Return the modified linked list.
A...
Detect and remove loop in a singly linked list in place with O(n) time complexity and O(1) space complexity.
Use Floyd's Cycle Detection Algorithm to identify the loop in the linked list.
Once the loop is detected, use two pointers to find the start of the loop.
Adjust the pointers to remove the loop and return the modified linked list.
Given a binary tree with N
nodes, your task is to output the Spiral Order traversal of the binary tree.
The input consists of a single line containing elem...
The task is to output the Spiral Order traversal of a binary tree given in level order.
Implement a function that returns the spiral order traversal as a list
Traverse the binary tree in a spiral order alternating between left to right and right to left
Use a queue to keep track of nodes at each level
Handle null nodes represented by -1 in the input
You are given an array ARR
of long type, which represents an elevation map where ARR[i]
denotes the elevation of the ith
bar. Calculate the total amount of rainwater t...
Calculate the total amount of rainwater that can be trapped within given elevation map.
Iterate through the array to find the maximum height on the left and right of each bar.
Calculate the amount of water that can be trapped above each bar by taking the minimum of the maximum heights on the left and right.
Sum up the trapped water above each bar to get the total trapped water for the elevation map.
Round duration - 20 minutes
Round difficulty - Easy
Timing (In Evening)
Environment (Same as Technical Interview)
In five years, I envision myself as a skilled technology professional, leading projects and mentoring junior developers in a dynamic team.
Career Growth: I aim to progress to a senior developer role, where I can take on more responsibilities and lead projects.
Skill Development: I plan to deepen my expertise in emerging technologies, such as AI and cloud computing, to stay ahead in the industry.
Mentorship: I aspire to me...
Tip 1 : For DS and Algo, keep practicing every day on Leetcode, HackerEarth, and make a habit of participating in contests.
Tip 2 : Projects are vital in interviews, have at least 3 projects on Resume, in the field/profile which you're applying for.
Tip 3 : Give Mock Interviews.
Tip 1 : Resume should be short and keep it under 1 page.
Tip 2 : Include skills that you're 100% confident in.
Tip 3 : Highlight your internships and projects section appropriately
I appeared for an interview in Sep 2020.
Round duration - 90 minutes
Round difficulty - Easy
It was an online coding round consisting of 3 questions conducted on Mettl platform. It started at 10:00 am and the test duration was of 90 mins. The questions were pretty easy of topics like arrays and strings.
Find the Nth prime number given a number N.
A prime number is greater than 1 and is not the product of two smaller natural numbers. A prime number has exa...
To find the Nth prime number given a number N, implement a function that returns the Nth prime number.
Create a function that takes N as input and returns the Nth prime number.
Iterate through numbers starting from 2 and check if each number is prime.
Keep track of the count of prime numbers found until reaching the Nth prime number.
Return the Nth prime number once it is found.
Given a string 'S' consisting of words, your task is to determine the number of palindrome words within 'S'. A word is considered a palindrome if it reads the same backw...
Count the number of palindrome words in a given string.
Split the string into words using whitespace as delimiter.
Check each word if it is a palindrome by comparing it with its reverse.
Increment a counter for each palindrome word found.
Output the total count of palindrome words for each test case.
Explanation: Sanyam wishes to distribute 'N' candies among 'K' friends. The friends are arranged based on Sanyam's order of likeness. He initially distributes candies s...
Distribute N candies among K people in Sanyam's order of likeness, incrementing distribution by K each round until all candies are distributed.
Distribute candies starting from 1st friend, incrementing by K each round
If remaining candies are fewer than what a friend is supposed to receive, stop distribution
Output the number of candies each friend ends up with at the end of distribution
Round duration - 20-30 minutes
Round difficulty - Easy
Interview was scheduled for 11:00 am and took around 20 mins. It was conducted on MS teams. The interviewer was polite and frank.
After the introduction he asked me some questions related to OOPS such as:
1. What are the principles of OOPS
2. What do you mean by polymorphism?
3. What is function overloading?
4. What are abstract classes and interface.
Then he gave me one coding question to solve. He told me to write the code on notepad and share screen.
question asked: Reverse the stack using recursion.
I was not able to solve this problem hence he gave me another question:
question: Reverse the linkedlist without using any extra space.
Reverse a given stack of integers using recursion. You must accomplish this without utilizing extra space beyond the internal stack space used by recursion. Additionally, you ...
Reverse a given stack of integers using recursion without extra space or loop constructs.
Use recursion to pop all elements from the original stack and store them in function call stack.
Once the stack is empty, push the elements back in reverse order using recursion.
Ensure to handle base cases for empty stack or single element stack.
Example: If the input stack is [1, 2, 3], after reversal it should be [3, 2, 1].
Given a Singly Linked List of integers, your task is to reverse the Linked List by altering the links between the nodes.
The first line of input is an intege...
Reverse a singly linked list by altering the links between nodes.
Iterate through the linked list and reverse the links between nodes
Use three pointers to keep track of the current, previous, and next nodes
Update the links between nodes to reverse the list
Return the head of the reversed linked list
Tip 1 : Leave the subject but never leave the topic
Tip 2 : Have good hold on DSA
Tip 3 : Always go through the interview experiences of the company and common interview questions
Tip 1 : Never add false things on your resume
Tip 2 : Add atleast 2 projects
posted on 7 May 2022
I applied via Campus Placement and was interviewed before May 2021. There were 2 interview rounds.
Basic aptitude knowledge
Strong in java
Developed a web-based project management tool for a startup
Used React for the frontend and Node.js for the backend
Implemented user authentication and authorization using JWT
Integrated with third-party APIs such as Trello and Slack
Implemented real-time updates using WebSockets
Deployed on AWS using EC2 and RDS
I am a software engineer with experience in developing web applications and mobile apps.
Proficient in programming languages such as Java, Python, and JavaScript
Skilled in using frameworks like React, Angular, and Spring Boot
Experienced in working with databases such as MySQL and MongoDB
Familiar with Agile development methodologies and DevOps practices
My dream is to build innovative software solutions that positively impact people's lives.
Developing cutting-edge technology
Creating user-friendly interfaces
Solving complex problems
Collaborating with talented individuals
Making a difference in society
Continuous learning and growth
based on 1 review
Rating in categories
Associate Staff Engineer
3.3k
salaries
| ₹10 L/yr - ₹36 L/yr |
Staff Engineer
3.3k
salaries
| ₹11.8 L/yr - ₹45 L/yr |
Senior Engineer
2.5k
salaries
| ₹6.4 L/yr - ₹23.5 L/yr |
Senior Software Engineer
1.2k
salaries
| ₹7.1 L/yr - ₹31 L/yr |
Software Engineer
1.1k
salaries
| ₹3.3 L/yr - ₹13 L/yr |
Deloitte
Cognizant
TCS
Accenture