Filter interviews by
Use merge sort algorithm to sort the array in O(nlogn) time complexity.
Implement merge sort algorithm which divides the array into two halves, recursively sorts the halves, and then merges the sorted halves.
Time complexity of merge sort is O(nlogn) where n is the number of elements in the array.
Example: ['apple', 'banana', 'cherry', 'date'] can be sorted using merge sort in O(nlogn) time complexity.
Use binary search to find element in sorted array efficiently.
Start with middle element and compare with target
If target is less, search left half, if greater search right half
Repeat until element is found or search space is empty
Top trending discussions
I appeared for an interview before Sep 2020.
Round duration - 90 minutes
Round difficulty - Easy
This round was held during university hours and consisted of 2 coding questions.
Round duration - 120 minutes
Round difficulty - Easy
Make sure you do no cutting and are clear about the approach you'd be following.
Running median of an input stream is the median value of the numbers seen so far in a continuous stream of data.
Maintain two heaps - a max heap for the lower half of the numbers and a min heap for the upper half.
Keep the number of elements in the two heaps balanced or differ by at most 1.
If the total number of elements is odd, the median is the root of the max heap. If even, it is the average of the roots of the two he...
Prepare for company-wise interview questions according to the company in which you are applying. Try to write the code yourself and if got stuck in between then take help from the internet. I recommend you Codezen of Coding Ninjas for practicing Data Structures and Algorithms based questions.
Application resume tips for other job seekersBe sure 100% of what you write in your resume and prepare for that before the interview what is written on resume.
Final outcome of the interviewSelectedI appeared for an interview in Sep 2016.
I am a dedicated software developer with a passion for creating innovative solutions.
Experienced in multiple programming languages such as Java, Python, and C++
Strong problem-solving skills and ability to work well in a team
Developed a mobile app for tracking fitness goals using React Native
The question is about bond and location.
Discuss the concept of bond and its importance in software development
Explain the significance of location in software development
Provide examples of how bond and location can impact software development projects
I applied via Referral
Convert a sorted array to balanced binary search tree
Find the middle element of the array and make it the root of the tree
Recursively construct the left subtree using the left half of the array
Recursively construct the right subtree using the right half of the array
Repeat until all elements are added to the tree
Reverse a singly linked list in groups of k inplace
Divide the linked list into groups of k nodes
Reverse each group of k nodes
Connect the reversed groups to form the final linked list
A recursive routine to calculate a ^ n
The base case is when n is 0, in which case the result is 1
For any other value of n, the result is a multiplied by the result of a^(n-1)
The recursive function should call itself with a^(n-1) as the new input
Design optimal data structure for never-ending stream of numbers for insertion, deletion, searching, kth largest and kth smallest.
Use a balanced binary search tree like AVL or Red-Black tree for efficient insertion, deletion, and searching.
Maintain two heaps, one for kth largest and one for kth smallest.
For finding kth largest, use a min heap of size k and for kth smallest, use a max heap of size k.
Alternatively, use a...
I appeared for an interview before Sep 2016.
Search an element in sorted rotated array.
Use binary search to find the pivot point where the array is rotated.
Divide the array into two subarrays and perform binary search on the appropriate subarray.
Handle the cases where the target element is at the pivot point or not present in the array.
Find the Kth largest element in an array.
Sort the array in descending order and return the element at index K-1.
Use a max heap to find the Kth largest element efficiently.
Implement a quickselect algorithm to find the Kth largest element in linear time.
Reverse a linked list in groups of n elements.
Divide the linked list into groups of n elements.
Reverse each group individually.
Connect the reversed groups to form the final linked list.
Handle cases where the number of elements is not a multiple of n.
Example: 1->2->3->4->5->6->7->8, n=3 -> 3->2->1->6->5->4->8->7
Find the median of two sorted arrays.
Merge the two arrays into one sorted array and find the median.
Use binary search to find the median in O(log(min(m, n))) time complexity.
Handle edge cases like empty arrays or arrays of different lengths.
Count number of paths from (0, 0) to (m, n) in a matrix while crossing through some indexes were not allowed.
Use dynamic programming to solve the problem
Create a 2D array to store the number of paths
Traverse the matrix and update the array based on the allowed paths
Return the value at the last index of the array
I appeared for an interview in Aug 2017.
I applied via Campus Placement
The question asks to convert the leaves of a binary tree into a doubly linked list without using extra space.
Traverse the binary tree in a depth-first manner
When a leaf node is encountered, update its left and right pointers to form the doubly linked list
Keep track of the previous leaf node to update its right pointer
Return the head of the doubly linked list
Count number of ways to reach opposite corner of a m*n table moving in two directions only.
Use dynamic programming to solve the problem
The number of ways to reach a cell is the sum of the number of ways to reach the cell above it and the cell to the left of it
The number of ways to reach the opposite corner is the number of ways to reach the cell in the last row and last column
Example: For a 2*2 table, there are 2 ways ...
The number of ways to travel n steps by taking one or two steps at a time.
This is a classic problem that can be solved using dynamic programming.
The number of ways to travel n steps is equal to the sum of the number of ways to travel n-1 steps and n-2 steps.
Use an array to store the number of ways for each step, starting with base cases for 0 and 1 steps.
Iterate through the array to calculate the number of ways for eac...
Convert infix expression to postfix expression.
Use a stack to keep track of operators.
Iterate through the infix expression and push operands to output.
If an operator is encountered, pop operators from stack until a lower precedence operator is found.
Push the operator to stack.
After iterating, pop remaining operators from stack and append to output.
Reverse the output to get postfix expression.
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
Remove characters from string A that appear in string B, considering their frequency in B.
Use a frequency counter for string B to track occurrences of each character.
Iterate through string A and build a new string excluding characters found in B.
Example: A = 'hello', B = 'l' -> Result: 'heo'.
Example: A = 'banana', B = 'an' -> Result: 'b'.
Consider edge cases like empty strings or no common characters.
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 ...
Implementing caching, optimizing queries, and using CDNs can reduce latency when accessing data from social networking sites.
Use caching mechanisms like Redis or Memcached to store frequently accessed data.
Optimize database queries to reduce response time, e.g., using indexes.
Implement pagination to load data in chunks instead of all at once.
Utilize Content Delivery Networks (CDNs) to serve static assets closer to user...
Use a min-heap to efficiently find the m closest points to an origin in a coordinate system.
1. Use a min-heap (priority queue) to store points based on their distance from the origin.
2. Calculate the distance using the Euclidean formula: distance = sqrt((x2 - x1)^2 + (y2 - y1)^2).
3. Insert points into the heap and maintain its size to m to keep only the closest points.
4. Example: For points (1,2), (3,4), (5,6) and orig...
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
Find a number in a consecutive integer array using binary search for optimal time complexity.
The array is sorted and consists of consecutive integers, e.g., [1, 2, 3, 4, 5].
Use binary search to find the number in O(log n) time complexity.
Calculate the mid index and compare the middle element with the target.
If the target is less than the middle element, search the left half; otherwise, search the right half.
Example: To...
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 ...
Validate user passwords against predefined conditions to ensure security and compliance.
Password must be at least 8 characters long. Example: 'Password1' is valid, 'Pass' is invalid.
Password must contain at least one uppercase letter. Example: 'Password1' is valid, 'password1' is invalid.
Password must contain at least one lowercase letter. Example: 'Password1' is valid, 'PASSWORD1' is invalid.
Password must include at l...
based on 1 interview experience
based on 1 review
Rating in categories
Assistant Manager
462
salaries
| ₹2.2 L/yr - ₹5 L/yr |
Shift Manager
355
salaries
| ₹1.5 L/yr - ₹4.3 L/yr |
Crew Member
292
salaries
| ₹1.1 L/yr - ₹2.8 L/yr |
Restaurant Manager
281
salaries
| ₹3.3 L/yr - ₹7.9 L/yr |
Crew Trainer
264
salaries
| ₹1.2 L/yr - ₹3.6 L/yr |
Amazon
Amazon Transportation Services
PepsiCo
KFC