Directi
10+ Smash Elevators Interview Questions and Answers
Q1. Suppose there are ‘n’ trees (literal trees, not trees of computer science, suppose they don’t have any branch, more like a straight stick), each of them have some height. We want x length of wood. We have a woo...
read moreQ2. Problem Statement: Sibling Nodes
You are provided with a Binary Tree consisting of 'N' nodes, where each node holds an integer value. Your objective is to identify and list all nodes that do not possess a sibli...read more
Identify and list nodes in a Binary Tree that do not have a sibling.
Traverse the Binary Tree in level order to identify sibling nodes.
Keep track of nodes without siblings and output them in ascending order.
Handle cases where nodes have only one child or no children.
Consider the root node as a sibling node.
Sort the output list of nodes without siblings in ascending order.
Q3. Maximum Product Subarray Problem Statement
Given an array of integers, determine the contiguous subarray that produces the maximum product of its elements.
Explanation:
A subarray can be derived from the origin...read more
Find the contiguous subarray with the maximum product of elements in an array.
Iterate through the array and keep track of the maximum and minimum product ending at each index.
Update the maximum product by taking the maximum of current element, current element * previous maximum, current element * previous minimum.
Update the minimum product by taking the minimum of current element, current element * previous maximum, current element * previous minimum.
Return the maximum produc...read more
Q4. Postfix Expression Evaluation Problem Statement
Given a postfix expression, your task is to evaluate the expression. The operator will appear in the expression after the operands. The output for each expression...read more
Evaluate postfix expressions by applying operators after operands. Return result modulo (10^9+7).
Iterate through each character in the postfix expression
If character is an operand, push it onto the stack
If character is an operator, pop two operands from stack, apply operator, and push result back
Repeat until end of expression, return final result modulo (10^9+7)
Q5. Merge Overlapping Intervals Problem Statement
Given a specified number of intervals, where each interval is represented by two integers denoting its boundaries, the task is to merge all overlapping intervals an...read more
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
Q6. You have an undirected weighted graph, given input ‘x’ and ‘y’, which are any two vertices of the graph, you have to output all the edges that are in any of the shortest path from x to y. Note that there can be...
read moreOutput all edges in any shortest path from x to y in an undirected weighted graph
Use Dijkstra's algorithm to find all shortest paths from x to y
Store the predecessor of each vertex to reconstruct the paths
Output all edges in any of the shortest paths found
Q7. Suppose there are two piles of plates in the table. One has ‘m’ RED plates and other has ‘n’ BLACK plates. In his/her chance, a player can either pick any number of red plates or any number black plates or equa...
read moreQ8. Suppose you are given a string of length n and a set of pairs(i, j such that 0 <= i < j < n). Pair “i, j” (0 based indexing) means that you can swap the i’th and j’th character in the string any number of times...
read moreGiven a string and pairs of indices, output the lexicographically smallest string after swapping characters.
Sort the pairs based on the first index in ascending order.
Use union-find data structure to keep track of connected components.
Swap characters in the string based on the connected components.
Return the lexicographically smallest string.
Q9. Suppose we have a huge CSV file having ip-address ranges and its corresponding country code, given any ip-address how will we find the country which it belongs to
To find the country of an IP address from a CSV file, we can use a lookup table based on the IP address range.
Create a lookup table from the CSV file with IP address ranges and corresponding country codes
Parse the given IP address and match it with the ranges in the lookup table to find the corresponding country code
Use binary search for efficient lookup in the IP address ranges
Handle cases where the given IP address falls outside the ranges in the lookup table
Design a streaming service like Netflix and explain content onboarding process.
Create a user-friendly dashboard for content providers to submit new content.
Implement a review process to ensure quality and compliance with guidelines.
Use algorithms to categorize and recommend new content to users based on their preferences.
Negotiate licensing deals with production companies to acquire new content.
Regularly update the library with fresh content to keep users engaged.
Q11. You have a huge linked list, how will you detect any loop in the linked list
To detect a loop in a linked list, we can use Floyd's Cycle Detection Algorithm.
Use two pointers, one moving at twice the speed of the other
If there is a loop, the two pointers will eventually meet at some point
Alternatively, use a hash set to store visited nodes and check for duplicates
Q12. Formulate the angle between the hour hand and minute hand of the clock for any given time
The angle between the hour hand and minute hand of a clock can be calculated using a simple formula.
The angle between the hour hand and minute hand is given by the formula: |(30H - 11/2) - 6M| degrees
H is the hour hand position and M is the minute hand position
If the result is greater than 180 degrees, subtract it from 360 degrees to get the acute angle
Q13. Difference between BST and tries
Top HR Questions asked in Smash Elevators
Interview Process at Smash Elevators
Top Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month