Filter interviews by
Given an integer array arr
of size N
, your task is to determine all indices of local minima and local maxima within the array. Return these indices in a 2-D list, w...
Find indices of local minima and maxima in an integer array.
Iterate through the array and compare each element with its neighbors to find local minima and maxima.
Consider corner elements separately by comparing with only one neighbor.
Return the indices of local minima and maxima in a 2-D list.
Given an integer array 'ARR' of size 'N' and an integer 'K', return all the subsets of 'ARR' which sum to 'K'.
A subset of an array 'ARR' is a tuple...
Given an array and an integer, return all subsets that sum to the given integer.
Use backtracking to generate all possible subsets of the array.
Keep track of the current subset and its sum while backtracking.
If the sum of the subset equals the target sum, add it to the result.
Recursively explore both including and excluding the current element in the subset.
Sort the elements in each subset to ensure increasing orde...
Two players, 'Ale' and 'Bob', are playing a game with a pile of stones. Your task is to determine the winner if both play optimally.
1. On each turn, a...
Determining the winner of a game where two players take turns to remove stones from a pile based on certain rules.
Implement a recursive function to simulate the game where each player makes the optimal move.
Check if the current player can take any stones, if not, the other player wins.
Return 'Ale' if 'Ale' wins, otherwise return 'Bob'.
Given an array or list ARR
of N
positive integers and an integer K
, your task is to rearrange all elements such that those with the K-th
bit (considering the rightmost bit as '1st' bit) equ...
Rearrange elements in an array based on the K-th bit being 0 or 1.
Iterate through the array and separate elements based on the K-th bit being 0 or 1.
Maintain the relative order of elements within each group.
Combine the two groups to get the final rearranged array.
Time complexity can be optimized to linear time by using bitwise operations.
Example: For ARR = {1, 2, 3, 4} and K = 1, output should be {2, 4, 1, 3}.
What people are saying about Uber
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 of oranges.
Track the time taken to rot all oranges and return -1 if any fresh oranges remain.
Handle edge cases such as empty grid, no fresh oranges, or no rotten oranges.
Update the status of adjacent fresh oranges to rotten oranges in each iteration.
Assume you initially have an empty array called ARR
. You are required to return the updated array after executing Q
number of queries on this array.
There are two types of quer...
Implement a function to update an array based on XOR queries.
Create an empty array to store the elements.
Iterate through each query and update the array accordingly.
Use bitwise XOR operation to update the elements.
Ensure to handle both types of queries - insert and XOR operation.
Given a 'Snake and Ladder' board with N rows and N columns, where positions are numbered from 1 to (N*N) starting from the bottom left, alternating direction each row, fi...
Find the minimum number of dice throws required to reach the last cell on a 'Snake and Ladder' board.
Use Breadth First Search (BFS) algorithm to find the shortest path on the board.
Create a mapping of each cell to its corresponding row and column on the board.
Consider the presence of snakes and ladders while calculating the next possible moves.
Handle the case where the last cell is unreachable by returning -1.
Opti...
You are located at point ‘A’, the top-left corner of an M x N matrix, and your target is point ‘B’, the bottom-right corner of the same matrix. Your task is to calculat...
Calculate total unique paths from top-left to bottom-right corner of a matrix by moving only right or down.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the number of unique paths for each cell.
Initialize the first row and first column with 1 as there is only one way to reach them.
For each cell, the number of unique paths is the sum of paths from the cell above and the cell t...
You are given a graph with 'N' vertices labeled from 1 to 'N' and 'M' edges. In one operation, you can shift an edge from being between two directly connected vertices...
Determine the minimum number of operations to connect a graph by shifting edges between disconnected vertices.
Use a disjoint set union (DSU) data structure to keep track of connected components.
Count the number of connected components in the graph.
The minimum number of operations required is equal to the number of connected components minus 1.
I applied via Campus Placement and was interviewed in Mar 2024. There were 2 interview rounds.
Graphs ,arrays , Hashmaps and Heaps
Changes on graph structure involve adding, removing, or modifying nodes and edges.
Adding a new node to the graph
Removing an existing node from the graph
Modifying the weight of an edge in the graph
I appeared for an interview in Dec 2020.
Round duration - 90 minutes
Round difficulty - Easy
This round had 2 coding problems and we had to code it on hackerearth only.
The use of Outside IDE was forbidden.
The timing of test was 12:00 PM to 1:30 PM.
Ninja is tasked with organizing a meeting in an office that starts at time ‘0’ and ends at time ‘LAST’. There are ‘N’ presentations scheduled with given start and end times....
Reschedule at most K presentations to maximize gap without overlap.
Iterate through presentations and calculate the gaps between them
Sort presentations by end time and reschedule K presentations to maximize gap
Return the longest gap achieved
You are located at point ‘A’, the top-left corner of an M x N matrix, and your target is point ‘B’, the bottom-right corner of the same matrix. Your task is to calcula...
Calculate total unique paths from top-left to bottom-right corner of a matrix by moving only right or down.
Use dynamic programming to solve this problem efficiently.
Create a 2D array to store the number of unique paths for each cell.
Initialize the first row and first column with 1 as there is only one way to reach them.
For each cell, the number of unique paths is the sum of paths from the cell above and the cell to the...
Round duration - 90 minutes
Round difficulty - Medium
This round was coding round with discussion .
The interviewer tried to trick the questions and wanted to test how we respond if something is asked out of preparation.
The code we ran on Google Docs was checked on Online IDE if it ran for sample inputs.
Timing : 12:00 PM to 1:30 PM
You are given a graph with 'N' vertices labeled from 1 to 'N' and 'M' edges. In one operation, you can shift an edge from being between two directly connected vertice...
Determine the minimum number of operations to connect a graph by shifting edges between disconnected vertices.
Use a disjoint set union (DSU) data structure to keep track of connected components.
Count the number of connected components in the graph.
The minimum number of operations required is equal to the number of connected components minus 1.
Given a 'Snake and Ladder' board with N rows and N columns, where positions are numbered from 1 to (N*N) starting from the bottom left, alternating direction each row, f...
Find the minimum number of dice throws required to reach the last cell on a 'Snake and Ladder' board.
Use Breadth First Search (BFS) algorithm to find the shortest path on the board.
Create a mapping of each cell to its corresponding row and column on the board.
Consider the presence of snakes and ladders while calculating the next possible moves.
Handle the case where the last cell is unreachable by returning -1.
Optimize ...
Round duration - 75 minutes
Round difficulty - Hard
This was a problem solving round and lasted for 75 minutes. The interviewer gave me a very complicated question.
The round was held on Google Meet and I was supposed to tell him the approach and write code on shared Google Docs.
Assume you initially have an empty array called ARR
. You are required to return the updated array after executing Q
number of queries on this array.
There are two types of que...
Implement a function to update an array based on XOR queries.
Create an empty array to store the elements.
Iterate through each query and update the array accordingly.
Use bitwise XOR operation to update the elements.
Ensure to handle both types of queries - insert and XOR operation.
Tip 1 : prepare all Topics from Coding Ninjas of Course Competitive Programming. Also I practiced atleast one question everyday from sites like Leetcode,Interviewbit and also took part in Codeforces Contest.
Tip 2 : Though Data Structure is the base for any tech interview, one must know some other subjects as well like Operating System, Networking, and Database Management System for which I took help from Coding Ninja’s notes and from GeeksforGeeks.
Tip 1 : Keep your resume up to date and mention 2-3 good level projects which will give a good impression to the interviewer .
Tip 2 : Don't put false things on the resume.
I appeared for an interview before Sep 2020.
Round duration - 90 minutes
Round difficulty - Medium
There were a total of three questions of 100, 200, and 300 points respectively. Partial points were given if partial tests got passed for any problem. The Codesignal environment was similar to Hackerrank, so not much different. I think the test was held in the afternoon time.
Two players, 'Ale' and 'Bob', are playing a game with a pile of stones. Your task is to determine the winner if both play optimally.
1. On each turn, ...
Determining the winner of a game where two players take turns to remove stones from a pile based on certain rules.
Implement a recursive function to simulate the game where each player makes the optimal move.
Check if the current player can take any stones, if not, the other player wins.
Return 'Ale' if 'Ale' wins, otherwise return 'Bob'.
Given an integer array 'ARR' of size 'N' and an integer 'K', return all the subsets of 'ARR' which sum to 'K'.
A subset of an array 'ARR' is a tupl...
Given an array and an integer, return all subsets that sum to the given integer.
Use backtracking to generate all possible subsets of the array.
Keep track of the current subset and its sum while backtracking.
If the sum of the subset equals the target sum, add it to the result.
Recursively explore both including and excluding the current element in the subset.
Sort the elements in each subset to ensure increasing order of ...
Round duration - 60 minutes
Round difficulty - Medium
This round was a video call round held on Zoom and the Codesignal platform was to be used for coding the problems. The round started with the interviewer giving a small introduction about him and then asking me to introduce myself.
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 of oranges.
Track the time taken to rot all oranges and return -1 if any fresh oranges remain.
Handle edge cases such as empty grid, no fresh oranges, or no rotten oranges.
Update the status of adjacent fresh oranges to rotten oranges in each iteration.
Given an integer array arr
of size N
, your task is to determine all indices of local minima and local maxima within the array. Return these indices in a 2-D list, ...
Find indices of local minima and maxima in an integer array.
Iterate through the array and compare each element with its neighbors to find local minima and maxima.
Consider corner elements separately by comparing with only one neighbor.
Return the indices of local minima and maxima in a 2-D list.
Round duration - 60 minutes
Round difficulty - Medium
The setup was exactly similar to the first interview round. The interviewer was very friendly. My advice will be to see the interviewer as a team mate and think you have to solve the question together with him. Don't panic and start speaking out what observations you can make about the problem.
Given an array or list ARR
of N
positive integers and an integer K
, your task is to rearrange all elements such that those with the K-th
bit (considering the rightmost bit as '1st' bit) eq...
Rearrange elements in an array based on the K-th bit being 0 or 1.
Iterate through the array and separate elements based on the K-th bit being 0 or 1.
Maintain the relative order of elements within each group.
Combine the two groups to get the final rearranged array.
Time complexity can be optimized to linear time by using bitwise operations.
Example: For ARR = {1, 2, 3, 4} and K = 1, output should be {2, 4, 1, 3}.
Round duration - 60 minutes
Round difficulty - Medium
It was already night time till this interview started because all the three interview rounds were held on the same day. This was not a DS+Algorithms round. He first asked me to introduce myself. So I started by telling what all I have done in my college up till now and then I told him about my internship experience at myKaarma which just ended few days back. There was around 10-15 minutes discussion on what I was working on in my intern project.
Tip 1 : Try to learn DS+Algorithms from the basics in the starting phase of your preparation. Though, in the later stages of the preparation, some cramming can be employed for the problems generally asked in the interviews (but that too with proper understanding)
Tip 2 : Don't forget to prepare topics like OS and OOP. Although I was not asked much about these topics but my friends were asked some questions from these topics. These topics can be prepared in 2-3 days from YouTube itself.
Tip 3 : For an intern role interview, 2-3 projects including the college projects should be enough. You should be prepared to explain your project answer the basic questions like the approach which you followed, the problems you faced during the project, etc.
Tip 4 : If possible you can have a prior intern experience as well, but one thing for sure, preparing DS+Algorithms is much more important than this.
Tip 1 : Writing things which you don't know about properly won't give you much benefit. Rather, they can get you into problem if asked about them.
Tip 2 : Writing much about the things like extra curricular activities in the resume for software roles don't give you much benefit in my opinion. Though I wrote 2-3 PORs which had.
Tip 3 : Trying to make your resume longer unnecessarily won't give you any benefit.
I appeared for an interview before Dec 2015.
I am excited to join the company because of its reputation for innovation and commitment to employee growth.
I am impressed by the company's track record of developing cutting-edge software solutions.
I appreciate the company's focus on fostering a culture of learning and development.
I am excited about the opportunity to work with a talented team of developers and contribute to the company's success.
I believe that the co...
What people are saying about Uber
I prioritize tasks, communicate effectively, and adapt my plans to manage interruptions while maintaining productivity.
Assess the interruption: Determine its urgency and importance. For example, if a team member needs immediate help, I prioritize that.
Reorganize my tasks: I create a new plan that accommodates the interruption while ensuring critical deadlines are met.
Communicate with stakeholders: I inform my team or m...
PreOrder traversal without recursion is done using a stack to simulate the function call stack.
Create an empty stack and push the root node onto it.
While the stack is not empty, pop a node from the stack and process it.
Push the right child of the popped node onto the stack if it exists.
Push the left child of the popped node onto the stack if it exists.
Yes
Create an empty binary search tree (BST)
Loop over the unsorted array
For each element, insert it into the BST using the appropriate insertion logic
Repeat until all elements are inserted
The resulting BST will be built from the unsorted array
The question asks to find two elements in an array whose sum is equal to a given number.
Iterate through the array and for each element, check if the difference between the given number and the current element exists in the array.
Use a hash set to store the elements as you iterate through the array for efficient lookup.
Return the pair of elements if found, otherwise return a message indicating no such pair exists.
There are two types of triggers: DML triggers and DDL triggers.
DML triggers are fired in response to DML (Data Manipulation Language) statements like INSERT, UPDATE, DELETE.
DDL triggers are fired in response to DDL (Data Definition Language) statements like CREATE, ALTER, DROP.
Examples: A DML trigger can be used to log changes made to a table, while a DDL trigger can be used to enforce certain rules when a table is alt...
Yes, triggers can be used with select statements in SQL.
Triggers are database objects that are automatically executed in response to certain events, such as insert, update, or delete operations.
While triggers are commonly used with insert, update, and delete statements, they can also be used with select statements.
Using triggers with select statements allows you to perform additional actions or validations before or af...
Indexing in MySQL improves query performance. There are several types of indexing in MySQL.
Indexes are used to quickly locate data without scanning the entire table.
Types of indexing in MySQL include B-tree, hash, full-text, and spatial indexes.
B-tree indexes are the most common and suitable for most use cases.
Hash indexes are used for exact match lookups.
Full-text indexes are used for searching text-based data efficie...
Engines in MySQL are the underlying software components that handle storage, indexing, and querying of data.
MySQL supports multiple storage engines, each with its own strengths and features.
Some commonly used engines in MySQL are InnoDB, MyISAM, and Memory.
InnoDB is the default engine in MySQL and provides support for transactions and foreign keys.
MyISAM is known for its simplicity and speed but lacks transaction suppo...
The Singleton pattern ensures a class has only one instance and provides a global point of access to it.
Restricts instantiation of a class to a single object.
Useful for managing shared resources, like database connections.
Implemented using private constructors and static methods.
Example in Java: public class Singleton { private static Singleton instance; private Singleton() {} public static Singleton getInstance() { if...
Yes, a constructor can be private.
A private constructor can only be accessed within the class itself.
It is often used in singleton design pattern to restrict object creation.
Private constructors are also useful for utility classes that only contain static methods.
I appeared for an interview before Dec 2020.
Round duration - 90 minutes
Round difficulty - Easy
Myntra had conducted a coding test on campus before the start of the placement season with 2 questions, one on stack and other on DP.
Tips : For the test, the DP question asked was pretty standard, on Longest Common Subsequence. The question on stacks, I don't remember what it was but it was also pretty straight forward. For the test, I would recommend to solve problem from GFG. If they do come to resume shortlisting, they are looking for people who have done good projects and internships.
Given two strings STR1
and STR2
, determine the length of their longest common subsequence.
A subsequence is a sequence that can be derived from another sequen...
The task is to find the length of the longest common subsequence between two given strings.
Implement a function to find the longest common subsequence between two strings.
Use dynamic programming to solve this problem efficiently.
Iterate through the strings and build a matrix to store the lengths of common subsequences.
Return the length of the longest common subsequence found.
Round duration - 60 minutes
Round difficulty - Easy
The interview started off with questions on my general interest in Software Development. The first round had two coding questions, I was supposed to write the code on paper.
For the questions, they asked me to code the solution first. And then gave a specific input and asked me to demonstrate step by step in my code, how it would lead to the correct answer.
Tips: It's ok if you can't code a general solution, if you can write a code which works for the particular input they have given then also it's ok with them. But be thorough with Data structures.
You are given two singly linked lists, where each list represents a positive number without any leading zeros.
Your task is to add these two numbers and return the sum as ...
Add two numbers represented as linked lists and return the sum as a linked list.
Traverse both linked lists simultaneously while keeping track of carry from previous sum
Create a new linked list to store the sum, updating the value and carry as needed
Handle cases where one linked list is longer than the other by adding remaining digits with carry
Round duration - 60 minutes
Round difficulty - Medium
I wasn't asked to write any code in this interview. They asked me some questions on Machine Learning, because of my projects in them. Then they asked me if I knew graph algorithms. Since I knew BFS and DFS, I told them. They asked the difference between the two. Then they asked me if I knew how to find the shortest distance between two points in a graph. I didn't know Dijkstra's properly but I knew it worked on the greedy approach so was able to tell that. Then they asked me how would I find the second shortest path. I tried to answer it with the same greedy approach, but couldn't arrive at the complete solution.
Tips: They ask a tough theoretical question. It's ok if you don't know the answer, they only look for your approach.
Given an undirected and disconnected graph G(V, E) where V vertices are numbered from 0 to V-1, and E represents edges, your task is to output the BFS traversal starting from the ...
BFS traversal in a disconnected graph starting from vertex 0.
Use a queue to keep track of nodes to visit next in BFS traversal
Start traversal from vertex 0 and explore its neighbors first
Continue exploring neighbors level by level until all nodes are visited
Ensure to print connected nodes in numerical sort order
Given an undirected and disconnected graph G(V, E)
, where V
is the number of vertices and E
is the number of edges, the connections between vertices are provided in the 'GR...
DFS traversal to find connected components in an undirected and disconnected graph.
Perform DFS traversal on each vertex to find connected components
Maintain a visited array to keep track of visited vertices
Print the vertices of each connected component in ascending order
Given an undirected graph with ‘V’ vertices (labeled 0, 1, ... , V-1) and ‘E’ edges, where each edge has a weight representing the distance between two connected nodes (X,...
Dijkstra's algorithm is used to find the shortest path from a source node to all other nodes in a graph with weighted edges.
Implement Dijkstra's algorithm to find the shortest path distances from the source node to all other nodes in the graph.
Use a priority queue to efficiently select the next node with the shortest distance.
Update the distances of neighboring nodes based on the current node's distance and edge weight...
Tip 1 : Be thorough with Data Structures and Algorithms and also with your resume.
Tip 2 : Must do Previously asked Interview as well as Online Test Questions.
Tip 3 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 4 : 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.
Print only the leaf nodes of a doubly linked tree.
Traverse the tree and check if a node has no children and both left and right pointers are null.
If yes, then it is a leaf node and print it.
If no, then continue traversing the tree.
Use recursion to traverse the tree in a depth-first manner.
LRU page replacement algorithm is used to replace the least recently used page in memory with a new page.
LRU stands for Least Recently Used
It is a cache eviction algorithm
It is used to manage memory in operating systems
It works by keeping track of the pages that are used recently and the ones that are not
When a new page is to be loaded into memory, the algorithm checks which page has not been used for the longest time ...
Reverse m nodes and leave n nodes in a linked list till the end.
Traverse the linked list till m nodes and reverse them
Traverse n nodes and continue reversing m nodes
Repeat the above step till the end of the linked list
Handle edge cases like m or n being greater than the length of the linked list
Inorder traversal is a way of visiting all nodes in a binary tree by visiting the left subtree, then the root, and then the right subtree.
Start at the root node
Traverse the left subtree recursively
Visit the root node
Traverse the right subtree recursively
Repeat until all nodes have been visited
Inorder traversal of a tree without recursion
Create an empty stack and initialize current node as root
Push the current node to stack and set current = current.left until current is NULL
If current is NULL and stack is not empty, pop the top item from stack, print it and set current = popped_item.right
Repeat step 2 and 3 until stack is empty
Find the triplicate number in an array of duplicates.
Iterate through the array and keep track of the frequency of each number.
Return the number that appears three times.
If no number appears three times, return null.
Explanation of search algorithms with their space and time complexities.
Linear Search - O(n) time complexity, O(1) space complexity
Binary Search - O(log n) time complexity, O(1) space complexity
Jump Search - O(√n) time complexity, O(1) space complexity
Interpolation Search - O(log log n) time complexity, O(1) space complexity
Exponential Search - O(log n) time complexity, O(1) space complexity
Fibonacci Search - O(log n) ...
Choosing the right search algorithm depends on data structure, size, and specific requirements like speed or memory usage.
Binary Search: Efficient for sorted arrays, O(log n) time complexity. Example: Finding a number in a sorted list.
Linear Search: Simple and works on unsorted arrays, O(n) time complexity. Example: Searching for a name in an unsorted list.
Depth-First Search (DFS): Suitable for tree/graph traversal, ex...
Find the most repeated number in an array of length n with numbers 1-n.
Create a dictionary to store the count of each number in the array
Iterate through the array and update the count in the dictionary
Find the key with the highest count in the dictionary
Change binary tree to make parent node the sum of root nodes
Traverse the tree in post-order
For each node, update its value to the sum of its children
Return the updated root node
Reverse a linkedlist by changing the direction of pointers.
Iterate through the linkedlist and change the direction of pointers.
Keep track of previous, current and next nodes.
Set the next pointer of current node to previous node.
Move to next node and repeat until end of list is reached.
Rearrange an array of positive and negative numbers with positive numbers on the left and negative numbers on the right.
Create two empty arrays, one for positive numbers and one for negative numbers
Loop through the original array and add positive numbers to the positive array and negative numbers to the negative array
Concatenate the positive and negative arrays to create the rearranged array
String pool is a cache of string literals in memory. Garbage collection frees up memory by removing unused objects.
String pool is a cache of string literals in memory
Strings are immutable and can be shared among multiple objects
Garbage collection removes unused objects to free up memory
String objects that are no longer referenced are eligible for garbage collection
Synchronizing a HashMap ensures thread safety when multiple threads access it concurrently.
Use Collections.synchronizedMap(): Wrap the HashMap with this method to create a synchronized version.
Example: Map<String, String> syncMap = Collections.synchronizedMap(new HashMap<>());
Use ConcurrentHashMap: This is a thread-safe alternative to HashMap that allows concurrent access.
Example: ConcurrentHashMap<Strin...
Process vs Thread differences and synchronization, deadlock examples
Process is an instance of a program while thread is a subset of a process
Processes are independent while threads share the same memory space
Synchronization is used to coordinate access to shared resources
Deadlock occurs when two or more threads are blocked waiting for each other to release resources
Examples of synchronization include mutex, semaphore, ...
Design a scalable website to process user requests and send email results asynchronously.
Use a microservices architecture to handle different processes independently.
Implement a message queue (e.g., RabbitMQ, Kafka) to manage requests and responses.
Utilize cloud services (e.g., AWS Lambda) for scalable processing of tasks.
Send emails using a reliable service (e.g., SendGrid, Amazon SES) to ensure delivery.
Implement loa...
based on 1 interview experience
Difficulty level
Duration
Driver
596
salaries
| ₹2 L/yr - ₹6 L/yr |
CAR Driver
355
salaries
| ₹1.8 L/yr - ₹5 L/yr |
Software Engineer
236
salaries
| ₹36.2 L/yr - ₹67.5 L/yr |
Senior Software Engineer
184
salaries
| ₹51.1 L/yr - ₹95 L/yr |
Data Analyst
161
salaries
| ₹10.5 L/yr - ₹19.4 L/yr |
Amazon
Ola Cabs
Airbnb