Filter interviews by
I applied via Naukri.com
I appeared for an interview before Dec 2020.
Round duration - 90 Minutes
Round difficulty - Medium
2 coding questions and 20 mcq
You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:
Find the minimum time required to rot all fresh oranges in a grid.
Use Breadth First Search (BFS) to simulate the rotting process.
Track the time taken to rot all oranges and return -1 if any fresh oranges remain.
Handle edge cases like no fresh oranges or all oranges already rotten.
Consider using a queue to efficiently process adjacent oranges.
Ensure to update the grid with the new state of oranges after each second.
Given a natural number N
, return the sum of all its proper divisors.
A proper divisor of Y
is defined as a number X
such that X < Y
and Y % X = 0
.
T...
Calculate the sum of proper divisors of a given natural number.
Iterate from 1 to sqrt(N) and check for divisors
If a divisor is found, add it to the sum and also add N/divisor if it is not the same as divisor
Return the sum as the result
Round duration - 45 Minutes
Round difficulty - Medium
Technical interview
Given an array ARR
consisting of non-negative integers, rearrange the numbers to form the largest possible number. The digits within each number cannot be changed.
Rearrange the array elements to form the largest possible number by concatenating them.
Sort the array elements in a custom comparator function to get the largest number.
Convert the sorted array elements to strings and concatenate them to form the final number.
Handle cases where the numbers have the same prefix by comparing the concatenated forms.
Tip 1 : Be clear about whatever you have mentioned in resume, don't mention buzz words, because interviewer can go in depth
Tip 2 : Along with DS and Algo, if you have 3-4 months experience or internship experience, then be ready to answer scenario based technical questions like scaling the application that you developed and design concepts that can be used for improving
Tip 3 : Last but most important tip is to be calm through out the whole process ,don't loose hope if any round didn't go well ,if you have explained your thought process there is still chance to procees to next round so keep preparating for next rounds.
Tip 1 : Keep it one page resume and mention keywords which align with your technical and personal competencies.
Tip 2 : Mention 3-4 projects in the order that , project which you can explain best should be at top,then the next, and so on.
I appeared for an interview before Sep 2020.
Round duration - 90 Miinutes
Round difficulty - Medium
First round had MCQ + 2 coding questions. It was held in morning around 11 am. It was held on campus.
You are tasked with directing a robot from the top-left corner of an N*N matrix to a specified point (x, y), delivering a parcel. The robot is restricted to move only on flat a...
Determine if a robot can reach a specified destination in a matrix by moving only downwards or rightwards.
Start at (0,0) and move towards the destination (x, y) only downwards or rightwards.
Check if the path is clear (1) and avoid obstacles (0) while staying within matrix boundaries.
Return true if the robot can reach the destination, false otherwise.
Example: For input matrix [[1, 0, 1], [1, 1, 1], [1, 1, 5]] with desti
Given an arbitrary array arr
consisting of N
non-negative integers where every element appears thrice except for one. Your task is to find the element in the array that appears onl...
Find the unique element in an array where every element appears thrice except for one.
Use XOR operation to find the unique element.
Iterate through the array and XOR each element to find the unique element.
The XOR operation cancels out elements that appear thrice, leaving only the unique element.
Example: arr = [2, 2, 3, 2], XOR of all elements = 3.
Example: arr = [0, 1, 0, 1, 0, 1, 99], XOR of all elements = 99.
Round duration - 90 Minutes
Round difficulty - Medium
Second Round was held in morning around 10-11 am. There was one interviewer working on his laptop. Interviewer was really helpful and first offered me water and then for a bit talked about himself.
You are tasked with implementing a class BSTIterator
, which is designed to traverse a Binary Search Tree (BST) in the inorder manner. The class must support the following op...
Implement a BSTIterator class to traverse a Binary Search Tree in inorder manner.
Implement a constructor to initialize the iterator with the root of the BST.
Implement next() and hasNext() methods to traverse the BST in inorder.
Implement prev() and hasPrev() methods to access the previous element in the inorder traversal.
Use level-order traversal format to represent the tree input.
Output the inorder traversal of the bin
Given a binary tree and the values of two distinct nodes, determine the distance between these two nodes in the tree. The distance is defined as the minimum num...
Calculate the distance between two nodes in a binary tree.
Traverse the tree to find the paths from the root to each node
Find the lowest common ancestor of the two nodes
Calculate the distance by adding the distances from the LCA to each node
Tip 1 : Keep talking about what are you thinking
Tip 2 : Don't beat about the bush if don't know the answer just say so
Tip 1 : Only show projects you are confident about
Tip 2 : Basic Web and android projects are also fine
I appeared for an interview before Sep 2020.
Round duration - 150 minutes
Round difficulty - Medium
We could attempt at any time out of the 3 given days.
The round was very time constrained and we could NOT go back to the question that we already attempted.
Given two sorted linked lists, your task is to merge them into a single sorted linked list. Return the head of the newly combined list.
The given linked lists may or ...
Merge two sorted linked lists into a single sorted linked list.
Create a dummy node to start the merged list
Compare nodes from both lists and add the smaller one to the merged list
Move the pointer of the merged list and the list with the smaller node
Handle cases where one list is exhausted before the other
Return the head of the merged list
Round duration - 60 minutes
Round difficulty - Hard
Evening at 5:00 pm. It was held on Amazon Chime app
Face cam was to be kept on COMPULSARILY. You could however not see the interviewer.
Codepen type environment was also used for typing my code which could be edited by the interviewer also.
(Shared document kind of)
Interviewer was very professional and was trying to push me towards getting the most optimal solution. Each and every answer was asked a counter question as to why I made that choice
You are provided with an array called ARR
, consisting of distinct positive integers. Your task is to identify all the numbers that fall within the range of the smallest a...
Identify missing numbers within the range of smallest and largest elements in an array.
Find the smallest and largest elements in the array.
Generate a list of numbers within the range of smallest and largest elements.
Remove the numbers that are present in the array to get the missing numbers.
Sort and return the missing numbers.
Given a Binary Search Tree (BST) and two integers, NODE1 and NODE2, determine the maximum element found in the path between NODE1 and NODE2.
...
Find the maximum element between two nodes in a Binary Search Tree (BST) path.
Traverse the BST to find the path between NODE1 and NODE2.
Keep track of the maximum element encountered in the path.
Return the maximum element found, or -1 if NODE1 or NODE2 are not in the BST or no elements exist between them.
Implement a program that performs basic string compression. When a character is consecutively repeated more than once, replace the consecutive duplicates with the coun...
Implement a program to compress a string by replacing consecutive duplicates with the count of repetitions.
Iterate through the string and keep track of consecutive characters and their counts.
Replace consecutive duplicates with the count of repetitions.
Ensure the count of repetitions is ≤ 9.
Return the compressed string.
Tip 1 : Be very very clear with your basics.
Tip 2 : Think well before giving an answer
Tip 3 : Practice, practice, practice DS Algo questions
Tip 1 : Limit it to 1 page ONLY.
Tip 2 : Be ready to face all kinds of questions on topics you have mentioned in the resume.
I appeared for an interview before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
Given an integer array ARR
of size N
, your task is to find the total number of inversions that exist in the array.
An inversion is defined for a pair of integers in the...
Count the total number of inversions in an integer array.
Iterate through the array and for each pair of elements, check if the conditions for inversion are met.
Use a nested loop to compare each element with all elements to its right.
Keep a count of the inversions found and return the total count at the end.
Given a postfix expression, your task is to evaluate the expression. The operator will appear in the expression after the operands. The output for each expr...
Evaluate postfix expressions by applying operators after operands. Return result modulo (10^9+7).
Iterate through each character in the postfix expression
If character is an operand, push it onto the stack
If character is an operator, pop two operands from stack, apply operator, and push result back
Continue until end of expression, return final result modulo (10^9+7)
Round duration - 40 minutes
Round difficulty - Medium
You are given a string of lowercase characters. The objective is to rearrange (reorder) the string so that no two adjacent characters are identical.
Return the rear...
Given a string of lowercase characters, rearrange it so that no two adjacent characters are identical. Return the rearranged string or 'NO SOLUTION'.
Iterate through the string and count the frequency of each character.
Sort the characters based on their frequency in non-increasing order.
Place the characters with highest frequency first, alternating with other characters.
If there are more than half of the characters with
Given an integer array ARR
of size N
and an integer S
, your task is to return a list of all pairs of elements such that the sum of each pair equals S
.
The first line co...
The task is to find pairs of elements in an array that sum up to a given target value.
Iterate through the array and for each element, check if the complement (target - current element) exists in a hash set.
If the complement exists, add the pair to the result list.
Ensure pairs are sorted based on the criteria mentioned in the question.
Round duration - 40 minutes
Round difficulty - Medium
You are provided with a 2-dimensional array/list of size N rows by M columns, containing ones (1) and zeroes (0). Here, 1 represents land, and 0 represents water.
A cell is consider...
Find the number of islands in a 2D matrix of 1s and 0s.
Iterate through the matrix and perform depth-first search (DFS) to find connected 1s.
Use a visited array to keep track of visited cells to avoid counting the same island multiple times.
Increment the island count whenever a new island is encountered.
Given a sorted doubly linked list of distinct nodes, determine how many triplets in the list have a sum equal to a given value 'X'. Each node in the list contains a...
Given a sorted doubly linked list of distinct nodes, find and count triplets with a sum equal to a given value 'X'.
Iterate through the list and for each node, use two pointers to find the other two nodes that sum up to 'X'.
Keep track of the count of triplets found and return it at the end.
Handle edge cases like when the list has less than 3 nodes or no triplets are found.
Tip 1 : Prepare application part of topics like graph other than the general questions.
Tip 2 : Prefer Leetcode for solving questions.
Tip 3 : Practice as many questions as possible from topic arrays.
Tip 1 : Add stuff you really have good knowledge about.
Tip 2 : Use the point-wise format for filling any area (eg: Brief explanation of projects).
I appeared for an interview before Sep 2020.
Round duration - 60 minutes
Round difficulty - Medium
In this round i was tested for Data Structure competency. Two questions were asked.
Given an array or list of strings called inputStr
, your task is to return the strings grouped as anagrams. Each group should contain strings that are anagrams of one anoth...
Group anagrams in an array of strings based on their characters.
Iterate through the array of strings and sort each string to group anagrams together.
Use a hashmap to store the sorted string as key and the list of anagrams as value.
Return the values of the hashmap as the grouped anagrams.
Round duration - 90 minutes
Round difficulty - Medium
Two questions were asked in this round on data structures and algorithms.
You are tasked with creating a class named BSTIterator
that acts as an iterator for the inorder traversal of a binary search tree. Implement the following functions:
BST...
Implement a BSTIterator class for inorder traversal of a binary search tree.
Create a BSTIterator class with constructor, next, and hasNext functions.
Use a stack to simulate inorder traversal of the binary search tree.
Ensure the hasNext function returns true if there are more elements to traverse.
Example: Input - 4 2 6 1 3 5 7 -1 -1 -1 -1 -1 -1, Output - 1 2 3 4 5 6 7
Given an array or list WORDS
of 'N' non-empty words and an integer 'K', identify the 'K' most frequent words and return them sorted by their frequency, in descendin...
Identify the K most frequent words in a list, sorted by frequency and lexicographical order.
Use a hashmap to store word frequencies
Use a min heap to keep track of K most frequent words
Sort the heap based on frequency and lexicographical order
Tip 1 : Build strong fundamentals in Data Structures and Algorithms. Practise basic data structures like Arrays, Linked List, Tree, Stack, Queues. For Graphs practise - BFS, DFS, Kruskal, Prims.
Tip 2 : Practice coding questions (medium-hard level) on online platforms like CodeZen, Codeforces, CodeChef.
Tip 3 : Practice mock interviews before the real interview.
Tip 1 : Briefly write you skills in which you are comfortable. Don't try to add anything vague as you will be questioned about everything which is written on resume.
Tip 2 : Have at least two projects on your resume which reflects application of your acquired skills
I appeared for an interview before Sep 2020.
Round duration - 60 minutes
Round difficulty - Easy
Round duration - 50 minutes
Round difficulty - Easy
Round duration - 60 minutes
Round difficulty - Easy
At the beginning of this round, the interviewer asked me about the data structures I knew. Linked lists, trees, graphs, arrays etc. was my answer. He asked me how well I knew Dynamic Programming. I said I wasn’t strong in that and he said that he would ask me a question on dynamic programming for sure.
Round duration - 40 minutes
Round difficulty - Easy
The interviewer asked me if I was comfortable with the interview process so far and how the previous interviews were. I said it was good and he gave me the first problem to solve.
Round duration - 60 minutes
Round difficulty - Easy
The interviewer asked me some Computer Science fundamentals in this round as well as some behavioural questions.
Implement a Trie data structure with insert and search functions.
Create a TrieNode class with children and isEndOfWord attributes.
Implement insert function to add words by iterating through characters.
Implement search function to check if a word exists by traversing the Trie.
Example: Insert 'apple', 'banana', 'orange' and search for 'apple' and 'grape'.
Do lot of hard work and practice of Data Structures and Algorithms based questions. I personally recommend you Coding Ninjas and Geeks For Geeks for interview preparation.
Application resume tips for other job seekersMake your resume short and try to make it of one page only and do mention all your skills which you are confident of in your resume.
Final outcome of the interviewSelectedI appeared for an interview before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
Given a string str
of length N, perform a series of operations to create a new string:
The problem involves selecting the smallest character from the first 'K' characters of a string and appending it to a new string until the original string is empty.
Iterate through the string, selecting the smallest character from the first 'K' characters each time.
Remove the selected character from the original string and append it to the new string.
If fewer than 'K' characters remain, sort and append them in order.
Rep...
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) as the result could be very large.
Round duration - 60 minutes
Round difficulty - Medium
1 hour online interview.
Slot was given prior via email.
The HR contacted me via email and simultaneously provided me a link where I had to write the codes during my interview
Mike, a young math enthusiast, is playing with his mom’s mobile phone, which has a keypad with 12 buttons (10 digits: 0-9, and 2 special characters: ‘*’ and ‘#’). His challe...
Calculate the number of distinct numbers that can be formed by pressing 'N' buttons on a mobile keypad following specific rules.
Use dynamic programming to keep track of the number of distinct numbers that can be formed at each step.
Consider the possible transitions from each button to calculate the total number of distinct numbers.
Implement a solution that efficiently handles large values by using modulo arithmetic.
Ens...
Given an array of integers, determine the maximum possible sum of any contiguous subarray within the array.
array = [34, -50, 42, 14, -5, 86]
Find the maximum sum of any contiguous subarray within an array of integers.
Iterate through the array and keep track of the maximum sum of subarrays encountered so far.
At each index, decide whether to include the current element in the subarray or start a new subarray.
Use Kadane's algorithm to efficiently find the maximum subarray sum in O(N) time complexity.
Given an array/list of ‘N’ integers, your task is to return the maximum sum of the subsequence where no two elements are adjacent in the given array/list.
Find the maximum sum of non-adjacent elements in an array.
Use dynamic programming to keep track of the maximum sum at each index, considering whether to include the current element or skip it.
At each index, the maximum sum is either the sum of the current element and the element two positions back, or the sum at the previous index.
Iterate through the array and update the maximum sum at each index accordingly.
Return the...
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 - 60 minutes
Round difficulty - Medium
Given an unweighted directed graph with V
vertices and E
edges, your task is to identify and print all the strongly connected component...
Tarjan's Algorithm is used to find strongly connected components in an unweighted directed graph.
Tarjan's Algorithm is a depth-first search based algorithm.
It uses a stack to keep track of vertices in the current SCC.
The algorithm assigns a unique id to each vertex and keeps track of the lowest id reachable from the current vertex.
Once a SCC is identified, the vertices in the stack form that SCC.
The algorithm runs in O...
Given the stock prices for 'N' days, your goal is to determine the maximum profit that can be achieved. You can buy and sell the stocks any number of times but can onl...
The goal is to determine the maximum profit that can be achieved by buying and selling stocks on different days.
Iterate through the stock prices and buy on days when the price is lower than the next day, and sell on days when the price is higher than the next day.
Calculate the profit by summing up the differences between buying and selling prices.
Repeat the process for each test case and output the maximum profit achie...
Round duration - 60 minutes
Round difficulty - Easy
This was a one hour round in which I was first told to introduce myself and then moved to questions.
Determine if the string str2
contains a permutation of the string str1
as one of its substrings.
The first line contains an integer 'T', representing the n...
Check if a permutation of one string is a substring of another string.
Create a frequency map of characters in str1.
Iterate through str2 with a window of size N and check if the frequency map matches.
Return 'Yes' if a permutation is found, 'No' otherwise.
You are provided with an integer array/list ARR
of size 'N' which consists solely of 0s, 1s, and 2s. Your task is to write a solution to sort this array/list.
Sort an array of 0s, 1s, and 2s in linear time with a single scan approach.
Use three pointers to keep track of the positions of 0s, 1s, and 2s in the array.
Iterate through the array once and swap elements based on their values and the pointers.
After the single scan, the array will be sorted in the required order.
Round duration - 60 minutes
Round difficulty - Medium
This was based more on my communication skills rather than my technical skills. The interviewer didn't only focus on whether I knew the answer or not but if I was able to communicate my knowledge to the interviewer.
It was more of theory based interview
Questions are as follows:-
1. What are SQL and acid properties?
2. How does a website start?
3. What are deadlocks with real life examples? Give necessary conditions for deadlock.
-> Real life examples were must.
4. What is virtual function?
5. Tell me the most challenging this while you made your project. ( I had to pick my project on my own)
6. Tell me the most interesting feature you found working on a language.
7. Technical question on structures in C as I used it in my project. The interviewer asked if the structure for a linked list is changed as:-
struct node
{
int data;
struct next;
};
I explained how this won't work as struct will be created again and again which will lead to memory limit exceeded.
Given a Singly Linked List of integers, remove all the alternate nodes from the list.
The first and the only line of input will contain the elemen...
Remove alternate nodes from a singly linked list of integers.
Traverse the linked list and skip every alternate node while updating the next pointers.
Make sure to handle cases where there are less than 3 nodes in the list.
Update the next pointers accordingly to remove alternate nodes.
Example: Input: 10 20 30 40 50 60 -1, Output: 10 30 50
Tip 1 : Listen carefully to what the interviewer expects from you.
Tip 2 : Practice at least 300 questions, topic wise.
Tip 3 : Do participate in contests.
Tip 1 : Be true on your resume.
Tip 2 : Make your resume crisp and clear.
I appeared for an interview in Sep 2020.
Round duration - 120 Minutes
Round difficulty - Medium
Four parts were there in the Amcat Test.
The first part was the code debugging round.
The second part consisted of two medium difficulty level problems.
The third part was based on Amazon LP.
The fourth part consisted of basic aptitude questions.
You are given a square binary matrix mat[n][n]
. The task is to determine an integer 'K' such that:
Find the row and column in a binary matrix where all elements in the row are 0 and all elements in the column are 1.
Iterate through each row and column to check for the conditions mentioned in the problem statement.
If a row has all 0s and the corresponding column has all 1s, return the index of that row/column.
If no such row/column exists, return -1.
Given a linked list where each node has two pointers: one pointing to the next node and another which can point randomly to any node in the list or ...
Deep copy a linked list with random pointers and return its head.
Create a deep copy of the linked list by creating new nodes rather than copying references.
Ensure the random pointers are correctly pointing to the corresponding nodes in the cloned list.
Implement the function to clone the linked list and return its head.
Consider the constraints and input format provided in the problem statement.
Explore if the cloning can
Round duration - 60 Minutes
Round difficulty - Medium
This interview consisted of 2 technical problems and some behavioral questions. This interview was taken by an SDE-3.
You are provided with a list, DICTIONARY[]
, which contains a collection of words, along with a stream of characters (queries). The task is to implement a class Chara...
Implement a class to check if a string formed by the last queried characters exists in a dictionary of words.
Use a trie data structure to efficiently store and search for words in the dictionary.
When solving a query, traverse the trie starting from the most recently queried character.
Return true if a valid word is found in the trie, otherwise return false.
Round duration - 60 minutes
Round difficulty - Easy
This round consisted of some behavioral questions and 2 technical problems. This round was conducted by and SDE-2.
You are given a doubly linked list of integers along with a positive integer K
that represents the group size. Your task is to modify the linked list by reversin...
Reverse groups of K nodes in a doubly linked list
Iterate through the linked list in groups of K nodes
Reverse each group of K nodes
Handle the case where the number of nodes left is less than K
Given an arbitrary binary tree consisting of N nodes, your task is to find the largest subtree sum.
First line of each input has a single integer T, denoting...
Find the largest subtree sum in an arbitrary binary tree.
Traverse the binary tree to calculate the subtree sum of each node.
Keep track of the maximum subtree sum encountered so far.
Recursively calculate the subtree sum for each node by considering its left and right children.
Consider edge cases like when the tree is empty or has only one node.
Tip 1: The key thing that played a major role in getting the internship was practicing problems daily on various coding platforms. One should prioritize solving Medium & Hard difficulty level problems.
Tip 2: Try to get really good at hierarchical Data Structures (Graphs, Trees) & various algorithms based on them, as they are commonly asked in big tech companies.
Tip 3: Should have at least 2 projects and it would be a plus if that project has some application in real life, but it's not necessary. And the biggest tip for getting placed into Amazon would be - 'Be familiar with Amazon Leadership Principle'. There are 14 Amazon LP in total and they can be found easily online.
Tip 1: Do not lie about anything on your resume
Tip 2: Just keep it clean and elegant, E.g. as it would not make an impact if you won some competition at the school level (It would just consume the precious space)
Tip 3: Mention the projects that you have worked on along with the tools & technologies
I applied via Company Website and was interviewed in May 2021. There was 1 interview round.
Senior Analyst
94
salaries
| ₹4.8 L/yr - ₹11.2 L/yr |
Team Lead
65
salaries
| ₹7 L/yr - ₹18 L/yr |
Analyst
53
salaries
| ₹3 L/yr - ₹7.9 L/yr |
Operations Analyst
38
salaries
| ₹3 L/yr - ₹6 L/yr |
Manager
27
salaries
| ₹10.5 L/yr - ₹28 L/yr |
Amazon
Uber
Fareportal
OLX