Filter interviews by
Given a positive integer N
, you are required to generate a list of integers of size 2N
such that it contains all the integers from 1 to N
, both included, twice. These int...
Generate Langford pairing for given N, return 'Valid' if correct, 'Invalid' if not.
Generate a list of integers of size 2N with Langford pairing rules
Return 'Valid' if pairing is correct, 'Invalid' if incorrect
If no valid pairing possible, return list with only -1 element
As the technical lead of the renowned ninja theater, your task is to implement a system that ensures social distancing by maximizing the distance between seated in...
Implement a system to maximize social distancing in a theater seating arrangement by determining the best seating arrangement for incoming theater-goers.
Create a function that takes the number of seats 'N' and a list of queries 'M' as input.
For each query of type 1, find the seat with the maximum distance from the nearest seated person.
Return the seat numbers a person should choose to maintain maximum distance fro...
Given an undirected graph with V vertices and E edges, your task is to find all the bridges in this graph. A bridge is an edge that, when removed, increases the number of ...
Find all the bridges in an undirected graph by identifying edges that, when removed, increase the number of connected components.
Use DFS to find bridges in the graph.
Identify bridges by checking if removing an edge increases the number of connected components.
Implement a function to find bridges in the graph.
Handle multiple test cases and output the count of bridges along with the vertices defining each bridge.
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherwi...
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraints.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access and updates.
When the cache reaches its capacity, evict the least recently used item before inserting a new item.
Update the order of keys in the link...
You are provided with a binary tree where each node's value is either 0 or 1. Your goal is to prune the binary tree by removing all subtrees that do not contain at lea...
Prune a binary tree by removing subtrees without any '1' nodes.
Traverse the tree using BFS and remove subtrees without any '1' nodes
Update the tree in level order after pruning
Return the pruned binary tree
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 c...
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 complement (target - element) exists in a hash set.
If the complement exists, add the pair to the result. If not, add the element to the hash set.
Handle edge cases like duplicate elements and the target being half of a single element.
Return (-1, -1) if no pairs a...
I appeared for an interview in Nov 2020.
Round duration - 160 minutes
Round difficulty - Easy
The online assessment consisted of four components, a code debugging section (20 minutes), a coding test (70 minutes), a workstyles assessment (20 minutes) and a reasoning ability section (35 minutes). Code debugging questions were pretty simple and straightforward. The coding test consisted of 2 questions, first was similar to two Sum problem. Second question was similar to find the critical edges in a graph. The workstyles assessment section contained certain behavioural questions.
Reasoning ability section consisted of aptitude questions. This round was basically to check the problem solving skills of the candidate.
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 complement (target - element) exists in a hash set.
If the complement exists, add the pair to the result. If not, add the element to the hash set.
Handle edge cases like duplicate elements and the target being half of a single element.
Return (-1, -1) if no pairs are fo...
Given an undirected graph with V vertices and E edges, your task is to find all the bridges in this graph. A bridge is an edge that, when removed, increases the number of...
Find all the bridges in an undirected graph by identifying edges that, when removed, increase the number of connected components.
Use DFS to find bridges in the graph.
Identify bridges by checking if removing an edge increases the number of connected components.
Implement a function to find bridges in the graph.
Handle multiple test cases and output the count of bridges along with the vertices defining each bridge.
Round duration - 50 minutes
Round difficulty - Easy
I was asked two coding questions. First question was related to binary tree and second question was to implement LRU cache.
I had to code both questions. The interviewer asked me the time and space complexity for both the questions.
You are provided with a binary tree where each node's value is either 0 or 1. Your goal is to prune the binary tree by removing all subtrees that do not contain at le...
Prune a binary tree by removing subtrees without any '1' nodes.
Traverse the tree using BFS and remove subtrees without any '1' nodes
Update the tree in level order after pruning
Return the pruned binary tree
Design a data structure for a Least Recently Used (LRU) cache that supports the following operations:
1. get(key)
- Return the value of the key if it exists in the cache; otherw...
Design a Least Recently Used (LRU) cache data structure that supports get and put operations with capacity constraints.
Implement a doubly linked list to keep track of the order of keys based on their recent usage.
Use a hashmap to store key-value pairs for quick access and updates.
When the cache reaches its capacity, evict the least recently used item before inserting a new item.
Update the order of keys in the linked li...
Round duration - 30 minutes
Round difficulty - Easy
I was asked two coding questions and some conceptual questions about priority heap data structure. I was able to code the optimized approach for the first question. But second question was a little tricky for me as I had never heard it before.
Given a positive integer N
, you are required to generate a list of integers of size 2N
such that it contains all the integers from 1 to N
, both included, twice. These in...
Generate Langford pairing for given N, return 'Valid' if correct, 'Invalid' if not.
Generate a list of integers of size 2N with Langford pairing rules
Return 'Valid' if pairing is correct, 'Invalid' if incorrect
If no valid pairing possible, return list with only -1 element
As the technical lead of the renowned ninja theater, your task is to implement a system that ensures social distancing by maximizing the distance between seated i...
Implement a system to maximize social distancing in a theater seating arrangement by determining the best seating arrangement for incoming theater-goers.
Create a function that takes the number of seats 'N' and a list of queries 'M' as input.
For each query of type 1, find the seat with the maximum distance from the nearest seated person.
Return the seat numbers a person should choose to maintain maximum distance from oth...
Tip 1 : Be very clear with the basics of each topic.
Tip 2 : Be thorough with the projects mentioned in the resume.
Tip 1 : Don't lie on your resume.
Tip 2 : The number of projects on the resume does not matter, what matters is that you must be thorough with your projects.
Tip 3 : Do not write too much, it should be simple and decent
Top trending discussions
I applied via Naukri.com and was interviewed before Aug 2020. There were 4 interview rounds.
Reversing a string involves rearranging its characters in the opposite order, which can be done using various methods.
Use built-in functions: In Python, you can reverse a string with slicing: `reversed_string = original_string[::-1]`.
Iterative approach: Loop through the string from the end to the beginning and build a new string.
Using recursion: Define a function that calls itself with a smaller substring until it reac...
I appeared for an interview before Sep 2020.
Round duration - 90 minutes
Round difficulty - Easy
This was an online technical round on the mettl platform, the test window was open from 22 to 25 May 2020
The test had 28 mcqs and 2 coding questions.
The test was proctored. One needed to have webcam on.
A sample test link was provided before test to get familiar with the mettl platform.
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 pair of elements efficiently.
Keep a count of the inversions found and return the total count at the end.
Given an array of positive integers, your task is to find the GCD (Greatest Common Divisor) of a pair of elements such that it is the maximum among all possible pair...
Find the pair with the maximum GCD in an array of positive integers.
Iterate through all pairs of elements in the array.
Calculate the GCD of each pair using Euclidean algorithm.
Keep track of the maximum GCD found so far.
Return the maximum GCD value.
Round duration - 60 minutes
Round difficulty - Medium
Time : 12pm to 1pm
Mode of Interview : Amazon Chime Video
LiveCode : To write code, it was not a compiler
The interviewer was quite supportive.
Given an array/list 'ARR' consisting of 'N' integers, your task is to find the majority element in the array. If there is no majority element present, return -1.
Find the majority element in an array, return -1 if no majority element exists.
Iterate through the array and keep track of the count of each element using a hashmap.
Check if any element's count is greater than floor(N/2) to determine the majority element.
Return the majority element or -1 if no majority element exists.
You are provided with an array/list ARR
of length N
containing only 0s and 1s. Your goal is to determine the number of non-empty subarrays where the numbe...
Count the number of subarrays where the number of 0s is equal to the number of 1s in a given array of 0s and 1s.
Iterate through the array and keep track of the count of 0s and 1s encountered so far.
Use a hashmap to store the difference between the counts of 0s and 1s seen at each index.
Increment the count of subarrays whenever the difference between the counts seen before matches the current difference.
Round duration - 60 minutes
Round difficulty - Medium
Time : 11 am to 12am
Mode of Interview : Amazon Chime Video
LiveCode : To write code, it was not a compiler
The interviewer was quite supportive.
Given a singly linked list where nodes contain values in increasing order, your task is to convert it into a Balanced Binary Search Tree (BST) using th...
Convert a sorted linked list into a Balanced Binary Search Tree (BST) using the same data values.
Create a function to convert the linked list to an array for easier manipulation.
Implement a function to build a Balanced BST from the array recursively.
Ensure the height difference of the subtrees is no more than 1 for each node.
Use level order traversal to output the values of the BST nodes.
Handle NULL nodes by representi...
Your task is to implement a Stack data structure using a Singly Linked List.
Create a class named Stack
which supports the following operations, each in O(1...
Implement a Stack data structure using a Singly Linked List with operations in O(1) time.
Create a class named Stack with getSize, isEmpty, push, pop, and getTop methods.
Use a Singly Linked List to store the elements of the stack.
Ensure each operation runs in O(1) time complexity.
Handle edge cases like empty stack appropriately.
Test the implementation with sample queries to verify correctness.
Tip 1 : Practice questions from all the topics as much as possible
Tip 2 : Be very much attentive while doing projects in college or anywhere, they are asked in detail if mentioned in resume.
Tip 3 : Be consistent while practicing and do a variety of questions rather than doing more questions of same kind.
Tip 1 : You should know whatever you have mentioned in your resume. Don't brag in your resume ever. Be very precise. It doesn't matter how much you have done, what matters is you are very much confident and clear about what you have done.
Tip 2 : Put your projects and the language you code in for sure in your resume.
I appeared for an interview before Sep 2020.
Round duration - 45 minutes
Round difficulty - Medium
The first Round was held on Hackerrank and the questions were of medium difficulty based on Data Structures and Algorithms.
The time of test was 1:00 PM and it was of 45 minutes with 2 coding questions to be solved.
Given a specified number of intervals, where each interval is represented by two integers denoting its boundaries, the task is to merge all overlapping interv...
Merge overlapping intervals and return sorted list of merged intervals.
Identify overlapping intervals based on start and end times
Merge overlapping intervals to form new intervals
Sort the merged intervals in ascending order of start times
Consider 'N' individuals standing in a circle, numbered consecutively from 1 to N, in a clockwise direction. Initially, the person at position 1 starts counting and will skip K-...
The Josephus problem involves eliminating individuals in a circle until only one remains, based on a specific counting rule.
Start counting from position 1, skip K-1 individuals, eliminate the Kth person, and continue until only one person remains.
The position of the last surviving person can be determined based on the initial numbering and the value of K.
Example: For N=5 and K=2, the last person standing is at position...
Round duration - 75 minutes
Round difficulty - Medium
A google Doc was shared with us and we were supposed to write code there.
Use of IDEs was not allowed so we had to write correct code on Google Docs which was later checked by them through online IDEs.
The Interviewer were friendly and observative and helped us through code if we made some silly error.
You are given an array/list HEIGHTS
of length N
, where each element represents the height of a histogram bar. The width of each bar is considered to be 1.
Compute the area of the largest rectangle that can be formed within the bounds of a given histogram.
Iterate through the histogram bars and maintain a stack to keep track of increasing heights.
Calculate the area of the rectangle formed by each bar as the smallest height in the stack times the width.
Update the maximum area found so far.
Time complexity can be optimized to O(N) using a stack-based approach.
Given a binary tree of integers, your task is to return the boundary nodes of the tree in Anti-Clockwise direction starting from the root node.
The first line ...
Return the boundary nodes of a binary tree in Anti-Clockwise direction starting from the root node.
Traverse the left boundary nodes in top-down order
Traverse the leaf nodes in left-right order
Traverse the right boundary nodes in bottom-up order
Handle duplicates in boundary nodes by including them only once
Round duration - 60 minutes
Round difficulty - Medium
The face to face round was held on Google Meet where initially Interviewer asked a DS/Algo problem and then Later Manager Joined and asked about our resume projects in detail.
The time was 10:00 AM
Given an M x N matrix of integers ARR
, your task is to identify the rectangle within the matrix that has the greatest sum of its elements.
The first line of input co...
Find the rectangle within a matrix with the greatest sum of elements.
Iterate through all possible rectangles within the matrix and calculate their sums
Use Kadane's algorithm to find the maximum sum subarray for each row combination
Keep track of the maximum sum found so far
You are provided with a sorted array that has undergone 'K' rotations (the exact value of 'K' is unknown). A rotation involves shifting each element of the array to the right,...
Find the minimum number in a rotated sorted array efficiently.
Use binary search to find the minimum element in the rotated array.
Compare mid element with the last element to determine which half to search.
Adjust the search space based on the comparison to find the minimum element efficiently.
Tip 1 : Prepare OS,DBMS,OOPs too
Tip 2 : Mention atleast one project or past work experience in your resume
Tip 3 : Try maintaining 8+ CGPA as sometimes shortlist is done based on CGPA
Tip 4 : Try past interview questions from Leetcode,Interviewbit.
Tip 1 : Try to Keep Resume 1 Pager
Tip 2 : Have atleast one project or past work experience mentioned
Tip 3 : Don't put false things on Resume as questions are asked in detail from Resume
I appeared for an interview in Dec 2020.
Round duration - 150 minutes
Round difficulty - Medium
Given a singly linked list of integers, determine if the linked list is a palindrome.
A linked list is considered a palindrome if it reads the same forwar...
Check if a given singly linked list of integers is a palindrome or not.
Traverse the linked list to find the middle element using slow and fast pointers.
Reverse the second half of the linked list.
Compare the first half with the reversed second half to determine if it's a palindrome.
You are given an integer array 'ARR' of size 'N' and an integer 'S'. Your task is to find and return a list of all pairs of elements where each sum of a pair equals 'S'.
Find pairs of elements in an array that sum up to a given value, sorted in a specific order.
Iterate through the array and for each element, check if the complement (S - current element) exists in a hash set.
If the complement exists, add the pair (current element, complement) to the result list.
Sort the result list based on the first element of each pair, and then based on the second element if the first elements are eq...
Round duration - 60 minutes
Round difficulty - Medium
You are provided with two integers, 'N' and 'D'. Your objective is to determine the square root of the number 'N' with a precision up to 'D' decimal pl...
Implement a function to find the square root of a number with a specified decimal precision.
Implement a function that takes two integers N and D as input and returns the square root of N with precision up to D decimal places.
Use mathematical algorithms like Newton's method to approximate the square root with the required precision.
Ensure that the difference between the computed result and the true square root is less t...
Tip 1 : Have more understanding and confidence over Data Structures and get good understanding of its concepts. At least practice 5-6 coding questions everyday on any coding platform. I had completed around 150+ questions on Leetcode and 250+ questions on Geek For Geeks. Practice regularly rather than completing all coding questions in one go.
Tip 2 : While attempting the questions analyze its time and space complexity. Always work on the strategies to further optimize your solution. Sometimes the interviewer asks only one question and keep on increasing its difficulty by asking for its optimization and will what kind of strategies you implement.
Tip 3 : Along with coding questions keep on studying concepts in details of Operating Systems, databases and object oriented programming. Refer to Geeks For Geeks articles for it. Also refer, Coding Ninja's Data Structures and algorithms course in C++ helped me a lot in improving my OOPS concepts specifically.
Tip 1 : Mention only those skills, projects or achievements which you have completed yourselves and thorough knowledge. Because there will be question around these and in case if you are not able to answer these basic questions it leaves a bad impact on interviewer.
Tip 2 : No need to add too many projects. Only one or two good projects with proper knowledge is fine. Also do the same for skills, do not add so many skills only add those one in which you can discuss and answer.
Tip 3 : Mention achievements which showcase your technical skills, communication skills, leadership quality or teamwork
I appeared for an interview in Sep 2020.
Round duration - 145 minutes
Round difficulty - Easy
The online assessment consisted of four components, a code debugging section (20 minutes), a coding test (70 minutes), a workstyles assessment (20 minutes) and a reasoning ability section (35 minutes). Code debugging questions were pretty simple and straightforward. The coding test consisted of 2 questions, first was similar to two Sum problem. Second question was similar to find the critical edges in a graph. The workstyles assessment section contained certain behavioural questions.
Reasoning ability section consisted of aptitude questions. This round was basically to check the problem solving skills of the candidate.
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 difference between the target and the element exists in a hash set.
If it exists, then print the pair (element, target-element), else add the element to the hash set.
If no pair is found, print (-1, -1).
In an undirected graph consisting of V
vertices and E
edges, your task is to identify all the bridges within the graph. A bridge is an edge which, when removed, result...
Identify bridges in an undirected graph by finding edges that, when removed, increase the number of connected components.
Use depth-first search (DFS) to find bridges in the graph.
Keep track of discovery time and low time for each vertex during DFS.
An edge (u, v) is a bridge if low[v] > disc[u].
Sort and print the bridge pairs in ascending order of vertices.
Example: If the input graph has vertices 0, 1, 2, 3, 4 and ed...
Round duration - 60 minutes
Round difficulty - Medium
I was asked two coding questions. First question was related to binary tree and second question was to implement LRU cache.
I had to code both questions. The interviewer asked me the time and space complexity for both the questions.
Given a circular array ARR
of size N
consisting of positive and negative integers, determine if there is a cycle present in the array. You can make movements based on...
Determine if a circular array has a cycle present, following specific movement rules.
Iterate through the array and check for cycles following the given movement rules.
Keep track of visited indices to detect cycles.
Handle both clockwise and counterclockwise movements separately.
Return 'True' if a cycle is found, 'False' otherwise.
Design and implement a Least Recently Used (LRU) cache data structure, which supports the following operations:
get(key)
- Return the value of the key if it exists in the cach...Implement a Least Recently Used (LRU) cache data structure with get and put operations.
Use a combination of a hashmap and a doubly linked list to efficiently implement the LRU cache.
Keep track of the least recently used item and update it accordingly when inserting new items.
Ensure to handle the capacity constraint by evicting the least recently used item when the cache is full.
For get operation, return the value of th...
Round duration - 60 minutes
Round difficulty - Medium
I was asked two coding questions and some conceptual questions about priority heap data structure. I was able to code the optimized approach for the first question. But second question was a little tricky for me as I had never heard it before. But I explained my approach confidently. The interviewer also helped me and finally I was able to code it.
Given 'N' ropes, each having different lengths, your task is to connect these ropes into one single rope. The cost to connect two particular ropes is equal to the sum of th...
Connect ropes with different lengths into one single rope with minimum cost by merging the smallest ropes first.
Sort the lengths of ropes in ascending order.
Merge the two smallest ropes at each step to minimize cost.
Keep track of the total cost as you merge the ropes.
Repeat the merging process until all ropes are connected.
Return the total cost as the minimum cost to connect all ropes.
Given a positive integer N
, you are required to generate a list of integers of size 2N
such that it contains all the integers from 1 to N
, both included, twice. These in...
Generate Langford pairing for given N, return 'Valid' if correct, 'Invalid' if not.
Generate a list of integers of size 2N with all integers from 1 to N twice.
Arrange integers according to Langford pairing rules.
Return 'Valid' if pairing is correct, 'Invalid' if not.
If no valid pairing possible, return list with only -1 element.
Tip 1 : Be very clear with the basics of each topic.
Tip 2 : Be thorough with the projects mentioned in the resume.
Tip 1 : Don't lie on your resume.
Tip 2 : The number of projects on the resume does not matter, what matters is that you must be thorough with your projects.
I appeared for an interview in Nov 2020.
Round duration - 120 minutes
Round difficulty - Medium
This was an online coding, mcq and debugging round round held on Amcat platform, there were 3 sections in the test.
1)20 MCQ questions {10 involving mathematics and the other 10 on programming fundamentals}; duration:20 mins;
you cannot navigate back to a questions after moving further, so have to answer carefully
2)debugging section- it involved 7 questions which were to be completed within 20 mins, 5 of them were very easy, each question only took almost a minute to figure out the problem with the code, last 2 questions were relatively moderate and there were errors at 3-4 sections of the entire code. I was able to solve all the questions in 15 mins
3)2 Coding questions- duration:80 mins, one was moderate on string while the other one involved dynamic programming, I was able to successfully execute all the available test cases.
Given two strings, S
and X
, your task is to find the smallest substring in S
that contains all the characters present in X
.
S = "abdd", X = "bd"
Find the smallest substring in S that contains all characters in X.
Use a sliding window approach to find the smallest window in S containing all characters of X.
Maintain a hashmap to keep track of characters in X and their frequencies.
Slide the window by moving the right pointer until all characters in X are found, then move the left pointer to minimize the window size.
Return the smallest window found.
Example: S = 'abd...
You are given a 2D matrix 'ARR' of size 'N x 3' with integers, where 'N' is the number of rows. Your task is to compute the smallest sum achievable by selecting one...
Find the smallest sum achievable by selecting one element from each row of a 2D matrix, following certain constraints.
Iterate through each row and find the minimum element that does not violate the constraints.
Keep track of the minimum sum achieved by selecting elements from each row.
Avoid selecting elements directly beneath previously selected elements.
Round duration - 45 minutes
Round difficulty - Hard
The interview started with introduction, there were two interviewers, they both introduced themselves and then asked me to introduce myself. Then we had a brief description on my projects, and they really appreciated my projects. Then as they were more concerned with DSA part, so we moved towards solving a coding problem. It was a famous rotten oranges problem with some change in language but as I haven't seen it beforehand, I wasn't able to give them an optimal approach and had to ask for some hints, but with a certain amount of help and hints, I was able to solve the problem and successfully coded it in 5 mins. Then the interviewers went for a dry run of the algorithm and tried to run it on each and every corner case, but as my algorithm was kind of bullet proof, it successfully passed all the corner cases.
Then they went for some questions on OOPS concepts involving inheritance and we had a long discussion on virtual function and runtime polymorphism. Then the interview was ended after a Q/A round that lasted for 3-4 minutes.
Given a grid containing oranges in three possible states:
Every second, any fresh orange adjac...
Given a grid with fresh and rotten oranges, determine the minimum time for all oranges to become rotten.
Create a queue to store the coordinates of rotten oranges and perform BFS to rot adjacent fresh oranges
Track the time taken to rot all oranges and return -1 if some fresh oranges remain
Handle edge cases like empty grid or no fresh oranges present
Example: For input grid = [[2,1,1],[1,1,0],[0,1,1]], the minimum time to...
Tip 1 : Try to keep yourself involved in competitive programming on regular basis {ex-Codechef, codeforces etc}
Tip 2 : brush up concepts on DSA and practice at least all questions from interviewbit and around 300 questions from GFG and Leetcode of upto intermediate level, this will help you in building your concepts and you will be quickly able to answer the questions in face to face interviews
Tip 3 : Complete some courses on data structures and algorithms and some programming languages{coding ninjas courses are preferable for valuable content}
Tip 1 : Try to keep only those things in resume on which you have very good command and you should be able to answer all of the questions(upto moderate level) related to your technical skills
Tip 2 : Mention your projects with brief description, try avoiding very high level description because some times reader might not be able to understand your work, keep it descriptive and understandable
I appeared for an interview in Nov 2020.
Round duration - 120 Minutes
Round difficulty - Medium
Around 4-5 pm
2 coding questions
7 debugging and output questions
20-30 aptitude questions
A section to test psychology based on various questions and situations.
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 ...
Cloning a linked list with random pointers by creating new nodes rather than copying references.
Create a deep copy of the linked list by iterating through the original list and creating new nodes with the same values.
Update the random pointers of the new nodes by mapping the original node's random pointer index to the corresponding new node.
Ensure the cloned linked list is an exact copy of the original by validating th...
You are provided with an array of integers ARR
of length N
. Your task is to determine the next smaller element for each array element.
The Next Smalle...
Given an array of integers, find the next smaller element for each element in the array.
Iterate through the array from right to left and use a stack to keep track of elements.
Pop elements from the stack until a smaller element is found or the stack is empty.
If no smaller element is found, output -1 for that element.
Round duration - 50 Minutes
Round difficulty - Medium
Timing - 4pm
Just asked one question based on DSA and asked to make the code modular and well indented.
Didn’t even ask for introduction.
You are given a grid containing oranges where each cell of the grid can contain one of the three integer values:
Find minimum time to rot all fresh oranges in a grid if adjacent to rotten oranges.
Use Breadth First Search (BFS) to simulate the rotting process of oranges.
Keep track of the time taken to rot all fresh oranges.
If at the end there are still fresh oranges left, return -1 as it is impossible to rot all oranges.
Round duration - 60 Minutes
Round difficulty - Medium
Started at 4pm
Interviewer introduced himself and then asked me for a brief introduction.
Went ahead to ask 2 DSA based questions.
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 into the heap.
Repeat until all elements are merged into a single sorted list.
You need to determine all possible paths for a rat starting at position (0, 0) in a square maze to reach its destination at (N-1, N-1). The maze is represented as an N*N ma...
Find all possible paths for a rat in a maze from source to destination.
Use backtracking to explore all possible paths in the maze.
Keep track of visited cells to avoid revisiting them.
Recursively try moving in all directions (up, down, left, right) until reaching the destination.
Add the current direction to the path and backtrack if the path leads to a dead end.
Return all valid paths found in alphabetical order as an ar...
Tip 1 : Smart Preparation is very important instead of just preparing everything.
Tip 2 : Going through previous interview experiences helps a lot.
Tip 3 : Focussing on time and space complexities instead of just the logic.
Tip 4 : Be thorough with the projects mentioned in resume.
Tip 5 : Daily practice of as many questions as possible with at least a couple of questions with level:Hard
Tip 1 : Keep it technical and to the point with no catch phrases.
Tip 2 : Use of action verbs to highlight the work put in projects or any previous internships.
Tip 3 : Use of bullet points.
Tip 4 : Mention clickable links of your projects, github account and certificates whenever possible.
I applied via Recruitment Consulltant and was interviewed before Nov 2021. There were 4 interview rounds.
MCQ's and Coding Problem - 1 related with Java, RDBMS, JS
TCS
Accenture
Wipro
Cognizant