Filter interviews by
I applied via LinkedIn and was interviewed in Sep 2024. There were 3 interview rounds.
IOS Swift Concepts - multiple choice questions
Create a app for displaying bookings
I applied via Naukri.com
I appeared for an interview in Aug 2017.
Merge Sort is a divide and conquer algorithm that sorts an array by dividing it into two halves, sorting them separately, and then merging the sorted halves.
Divide the array into two halves
Recursively sort the two halves
Merge the sorted halves
Find pairs of integers in a BST whose sum is equal to a given number.
Traverse the BST and store the values in a hash set.
For each node, check if (X - node.value) exists in the hash set.
If yes, add the pair (node.value, X - node.value) to the result.
Continue traversal until all nodes are processed.
Merge overlapping time intervals into mutually exclusive intervals.
Sort the intervals based on their start time.
Iterate through the intervals and merge overlapping intervals.
Output the mutually exclusive intervals.
Example: [(1,3), (2,6), (8,10), (15,18)] -> [(1,6), (8,10), (15,18)]
Different types of hashing and alternative for Linear Chaining
Different types of hashing include division, multiplication, and universal hashing
Alternative for Linear Chaining is Open Addressing
Open Addressing includes Linear Probing, Quadratic Probing, and Double Hashing
An AVL tree is a self-balancing binary search tree where the heights of the left and right subtrees differ by at most one.
AVL tree is a binary search tree with additional balance factor for each node.
The balance factor is the difference between the heights of the left and right subtrees.
Insertion and deletion operations in AVL tree maintain the balance factor to ensure the tree remains balanced.
Rotations are performed ...
Find the minimum number of squares whose sum equals to a given number n.
Use dynamic programming to solve the problem efficiently.
Start with finding the square root of n and check if it is a perfect square.
If not, then try to find the minimum number of squares required for the remaining number.
Repeat the process until the remaining number becomes 0.
Return the minimum number of squares required for the given number n.
Insertion sort for a singly linked list.
Traverse the list and compare each node with the previous nodes
If the current node is smaller, swap it with the previous node
Repeat until the end of the list is reached
Time complexity is O(n^2)
I appeared for an interview before Jan 2021.
Round duration - 60 Minutes
Round difficulty - Medium
This was a typical DS/Algo where I was asked to solve two questions related to Binary Trees and write the pseudo code for both of them followed by some theoretical questions related to Operating Systems.
Given a binary search tree (BST) consisting of integers and containing 'N' nodes, your task is to find and return the K-th largest element in this BST.
If there is no K-th la...
Find the K-th largest element in a BST.
Perform reverse in-order traversal of the BST to find the K-th largest element.
Keep track of the count of visited nodes to determine the K-th largest element.
Return -1 if there is no K-th largest element in the BST.
Determine if the given binary tree is height-balanced. A tree is considered height-balanced when:
Determine if a given binary tree is height-balanced by checking if left and right subtrees are balanced and their height difference is at most 1.
Check if the left subtree is balanced
Check if the right subtree is balanced
Calculate the height difference between the left and right subtrees
Return 'True' if all conditions are met, otherwise return 'False'
Zombie process is a terminated process that has completed execution but still has an entry in the process table. Orphan process is a process whose parent process has terminated.
Zombie process is created when a child process completes execution but its parent process has not yet read its exit status.
Zombie processes consume system resources and should be cleaned up by the parent process using wait() system call.
Orphan p...
Round duration - 60 Minutes
Round difficulty - Medium
This was also a Data Structures and Algorithm round where I was asked to solve 3 medium to hard level problems along with their pseudo code within 60 minutes .
Given a string S
of length L
, determine the length of the longest substring that contains no repeating characters.
"abac...
Find the length of the longest substring without repeating characters in a given string.
Use a sliding window approach to keep track of the longest substring without repeating characters.
Use a hashmap to store the index of each character in the string.
Update the start index of the window when a repeating character is found.
Calculate the maximum length of the window as you iterate through the string.
Return the maximum le
Given a sorted array that has been rotated clockwise by an unknown amount, you need to answer Q
queries. Each query is represented by an integer Q[i]
, and you must ...
Search for integers in a rotated sorted array efficiently.
Use binary search to efficiently search for integers in the rotated sorted array.
Handle the rotation of the array while performing binary search.
Return the index of the integer if found, else return -1.
Given an array ARR
and an integer K
, your task is to count all subarrays whose sum is divisible by the given integer K
.
The first line of input contains an...
Count subarrays with sum divisible by K in an array.
Iterate through the array and keep track of the prefix sum modulo K.
Use a hashmap to store the frequency of each prefix sum modulo K.
For each prefix sum, increment the count by the frequency of (prefix sum - K) modulo K.
Handle the case when prefix sum itself is divisible by K.
Return the total count of subarrays with sum divisible by K.
Round duration - 50 Minutes
Round difficulty - Medium
In this round , I was asked to code a simple question related to BST . After that I was asked the internal implementation of a Hash Map where I was supposed to design a Hash Map using any of the Hashing Algorithms that I know . This was preety challenging for me but I got to learn so much from it.
Given a Binary Search Tree (BST) and an integer, write a function to return the ceil value of a particular key in the BST.
The ceil of an integer is defined as the s...
Ceil value of a key in a Binary Search Tree (BST) is found by returning the smallest integer greater than or equal to the given number.
Traverse the BST to find the closest value greater than or equal to the key.
Compare the key with the current node value and update the ceil value accordingly.
Recursively move to the left or right subtree based on the comparison.
Return the ceil value once the traversal is complete.
Create a data structure that maintains mappings between keys and values, supporting the following operations in constant time:
1. INSERT(key, value): Add or update t...
Design a constant time data structure to maintain mappings between keys and values with various operations.
Use a hash table to achieve constant time complexity for INSERT, DELETE, SEARCH, and GET operations.
Keep track of the number of key-value pairs for GET_SIZE operation.
Check if the hash table is empty for IS_EMPTY operation.
Return true or false for SEARCH operation based on key existence.
Return the value associated...
Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
I appeared for an interview before Jan 2021.
Round duration - 90 Minutes
Round difficulty - Hard
I found the online coding round of Flipkart to be quite difficult based on the constraints of the problem and their time limits. I coded the first problem quite easily but on the second and the third problem , my code could only pass a few test cases and gave TLE for most of them. Both the questions required very efficient solution and the last 5 to 10 Test Cases carried more weight than the rest so I didn't get through this round.
Given three non-negative integers N, M, and K, compute the Kth digit from the right in the number obtained from N raised to the power M (i.e., N ^ M).
The first line contains ...
The task is to find the Kth digit from the right in the number obtained from N raised to the power M.
Iterate through the digits of N^M from right to left
Keep track of the position of the current digit
Return the digit at position K from the right
Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette when viewed from a distance. Each building is ...
Compute the skyline of given rectangular buildings in a 2D city, eliminating hidden lines and forming the outer contour of the silhouette.
Iterate through the buildings and create a list of critical points (x, y) where the height changes.
Sort the critical points based on x-coordinate and process them to form the skyline.
Merge consecutive horizontal segments of equal height into one to ensure no duplicates.
Return the fin...
You are provided with a string STR
of length N
. The goal is to identify the longest palindromic substring within this string. In cases where multiple palind...
Identify the longest palindromic substring in a given string.
Iterate through the string and expand around each character to find palindromes
Keep track of the longest palindrome found
Return the longest palindrome with the smallest start index
Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.
Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.
Reverse a binary search tree while maintaining parent-child relationship.
Start by swapping the left and right child of each node recursively.
Use a depth-first search approach to traverse the tree.
Make sure to update the parent-child relationships accordingly.
To find min and max element in stack in O(1), we can use an auxiliary stack.
Create an auxiliary stack to keep track of the minimum and maximum elements.
Push the first element to both the main and auxiliary stack.
For each subsequent element, compare it with the top element of the auxiliary stack and push the smaller element to the auxiliary stack.
To get the minimum element, simply return the top element of the auxiliary...
Given an array, find the next minimum element for each element.
Iterate through the array
For each element, compare it with the elements on its right
Find the minimum element greater than the current element
If no such element exists, assign -1
Build the resultant array
Find median of input stream in minimum time complexity using online algorithm.
Use two heaps, one max heap for elements smaller than current median and one min heap for elements greater than current median.
Maintain balance between the two heaps by ensuring that the size difference is at most 1.
If the size of both heaps is equal, median is the average of the top elements of both heaps. Else, median is the top element of ...
To make a copy of a linked list with two pointers, iterate through the original list and create a new node for each element.
Iterate through the original linked list
Create a new node for each element
Set the 'next' pointer of each new node
Set the 'arbitrary' pointer of each new node
Reverse the nodes of a linked list in pairs of n
Iterate through the linked list in pairs of n
Reverse the nodes within each pair
Connect the reversed pairs together
Handle cases where the number of nodes is not a multiple of n
To check if a singly linked list is a palindrome, reverse the second half and compare it with the first half.
Traverse the linked list to find the middle node
Reverse the second half of the linked list
Compare the reversed second half with the first half to check for palindrome
Given a preorder of binary tree with leaf nodes represented by N, construct the tree.
Start by creating an empty stack.
Iterate through the preorder list.
If the current element is N, create a leaf node and push it onto the stack.
If the current element is not N, create a new node and set its left child to the top of the stack.
Pop the top of the stack and set it as the right child of the new node.
Push the new node onto the...
The question asks to find the maximum occupancy word in each line of a given multiline string and also count the occupancy of capital and small letters separately.
Split the multiline string into individual lines
For each line, split it into words
Initialize variables to store the maximum occupancy word and its count
Iterate through each word and count the occupancy of each letter
If the current word has a higher occupancy ...
Algorithm to find the best buying and selling dates for maximum profit from given stock prices array.
Iterate through the array and keep track of minimum price and maximum profit.
If current price is less than minimum price, update minimum price.
If current price minus minimum price is greater than maximum profit, update maximum profit and buying and selling dates.
Return buying and selling dates.
Example: [10, 7, 5, 8, 11,...
The code finds the number of ways to reach n steps by jumping 1 or 2 steps at a time.
Use dynamic programming to solve the problem
Create an array to store the number of ways to reach each step
Initialize the array with base cases for 0 and 1 steps
Iterate through the array and calculate the number of ways for each step
Return the value at the last step
Amazon.com is an online retail giant with a vast selection of products and services.
Advantages: Wide selection of products, competitive pricing, fast shipping, convenient shopping experience
Disadvantages: Can put smaller retailers out of business, concerns over worker treatment and environmental impact
Example: Amazon Prime offers free two-day shipping and access to streaming services like Prime Video and Music
Example: ...
Use file locking mechanisms like flock or lockfile to make a file mutually exclusive on a shared file system.
Use flock or lockfile to acquire a lock on the file before accessing it.
Release the lock once the operation is complete.
Ensure all processes accessing the file use the same locking mechanism.
Example: flock /path/to/file -c 'command to execute'
Example: lockfile /path/to/file && command to execute && rm -f /path/t
I am a software developer with 5 years of experience in developing web applications using Java and JavaScript.
5 years of experience in software development
Proficient in Java and JavaScript
Developed web applications
Strong problem-solving skills
Experience with agile development methodologies
Positive: Strong problem-solving skills, Negative: Can be overly critical of own work
Positive: Strong problem-solving skills - I excel at breaking down complex problems and finding efficient solutions
Negative: Can be overly critical of own work - I tend to be perfectionistic and struggle with accepting imperfections
I had a failure in implementing a new feature due to a lack of understanding of the requirements.
I was assigned to develop a new feature for our software application.
I misunderstood the requirements and implemented the feature incorrectly.
During the testing phase, it was discovered that the feature was not functioning as expected.
I took responsibility for the mistake and immediately communicated it to my team lead.
I wo...
Replace every element in array with its closest maximum element in right.
Iterate through the array from right to left
Keep track of the maximum element seen so far
Replace each element with the maximum element seen so far
Designing a distributed Hashtable and discussing its pros and cons.
Distributed Hashtable is a data structure that stores key-value pairs across multiple nodes.
Pros include scalability, fault tolerance, and load balancing.
Cons include increased complexity, potential for data inconsistency, and slower performance due to network communication.
Examples of distributed Hashtable implementations include Cassandra, Riak, and D
To identify if a tree is a BST, check if the inorder traversal of the tree results in a sorted sequence.
Perform an inorder traversal of the tree
Check if the resulting sequence is sorted in ascending order
If yes, the tree is a BST; otherwise, it is not
My favorite subject is computer science and I excel in problem-solving and algorithm design.
Computer science is my favorite subject because I enjoy coding and creating software applications.
I am best at problem-solving, as I have a strong analytical mindset and can efficiently break down complex issues.
I excel in algorithm design, as I have a deep understanding of data structures and can optimize code for efficiency.
Paging is a memory management technique used by operating systems to manage memory more efficiently. Virtual memory is a technique that allows a computer to use more memory than it physically has available.
Paging divides memory into fixed-size blocks called pages.
Virtual memory allows programs to use more memory than is physically available by temporarily transferring pages of data from RAM to disk.
Virtual memory also ...
The remaining memory is not wasted, but reserved for other system processes and applications.
The operating system reserves a portion of the RAM for its own processes and functions.
The unused memory can be used for caching data, improving system performance.
Applications and processes may not require the full amount of RAM at all times.
The unused memory can be allocated to other applications when needed.
Virtual memory an...
Return the total possible positions for a knight on a chess board given the number of combinations of moves.
Calculate all possible positions for a knight on a chess board using its unique L-shaped moves.
Consider the boundaries of the chess board while calculating the positions.
The total possible positions for a knight on a chess board are 64.
Use file locking mechanism to ensure mutual exclusion.
Implement file locking mechanism to prevent simultaneous access to files.
Use semaphores or mutexes to ensure only one process can access a file at a time.
Implement a queue system to handle multiple requests and process them one by one.
Use transactional file systems to ensure atomicity of file operations.
Implement a timeout mechanism to prevent deadlocks.
Consider imp...
Implementing a hash table in code
Choose a hash function to map keys to indices in the table
Create an array to hold the values at each index
Handle collisions by using a collision resolution strategy
Implement methods for inserting, retrieving, and deleting values
Consider load factor and resizing the table if necessary
The given question asks to replace the value in each node of a binary search tree with the sum of all nodes greater than the current node.
Traverse the BST in reverse order (right, root, left)
Keep track of the sum of all greater nodes encountered so far
Update the value of each node with the sum and update the sum
The next inorder predecessor in a binary search tree (BST) is the node with the largest value smaller than the given node.
In a BST, the inorder predecessor of a node is the rightmost node in its left subtree.
If the left subtree of the given node is empty, then the inorder predecessor is the nearest ancestor whose right child is also an ancestor of the given node.
If there is no inorder predecessor (i.e., the given node
Generate all possible parentheses for a given integer n.
Use recursion to generate all possible combinations of parentheses.
Start with an empty string and keep adding opening and closing parentheses.
Keep track of the number of opening and closing parentheses used.
Stop recursion when the number of opening and closing parentheses reaches n.
Add the generated combination to the result array.
The question asks how to feed a 2D matrix with values based on the given binary tree.
Traverse the binary tree and for each node, update the corresponding row in the matrix
Use a recursive function to update the matrix values
Start with the root node and recursively update its descendants
Set M[i, j] to 1 if node i is an ancestor of node j
Repeat the process for all nodes in the binary tree
Find the first occurrence of a given key element in a sorted array with duplicates.
Use binary search to find the key element.
If the key element is found, check if it is the first occurrence by checking the previous element.
If the key element is not found, return -1.
Spiral order traversal of a binary tree
Use a stack and a queue to traverse the binary tree in a spiral order
Start with the root node and add it to the stack
While the stack is not empty, pop a node from the stack and add its children to the queue
If the stack is empty, swap the stack and queue
Repeat until both stack and queue are empty
Queue can be implemented using two stacks by maintaining the order of elements.
Use two stacks, one for enqueue operation and one for dequeue operation
When enqueue is called, push the element onto the enqueue stack
When dequeue is called, if the dequeue stack is empty, transfer all elements from enqueue stack to dequeue stack
Pop the top element from the dequeue stack and return it as the dequeued element
Edit distance problem is a dynamic programming problem to find the minimum number of operations required to transform one string into another.
The problem can be solved using dynamic programming approach
The solution involves filling up a matrix of size (m+1)x(n+1)
The matrix represents the minimum number of operations required to transform one string into another
The operations include insertion, deletion and substitution
...
To find a loop in a linked list, we can use the Floyd's cycle-finding algorithm.
Initialize two pointers, slow and fast, both pointing to the head of the linked list.
Move slow pointer by one step and fast pointer by two steps at each iteration.
If there is a loop, the slow and fast pointers will eventually meet.
To prove the algorithm, we can use mathematical induction and the concept of tortoise and hare.
based on 1 interview
Interview experience
Accounts Manager
16
salaries
| ₹12 L/yr - ₹18 L/yr |
Senior Product Manager
14
salaries
| ₹45 L/yr - ₹98.2 L/yr |
Trust and Safety Specialist
11
salaries
| ₹9 L/yr - ₹20 L/yr |
Engineering Manager
9
salaries
| ₹62 L/yr - ₹135.5 L/yr |
Product Manager
8
salaries
| ₹36 L/yr - ₹96 L/yr |
Amazon
Flipkart
Amazon Development Centre India
Udaan