Add office photos
Employer?
Claim Account for FREE

Directi

4.1
based on 59 Reviews
Video summary
Filter interviews by

10+ Smash Elevators Interview Questions and Answers

Updated 5 Feb 2024
Popular Designations

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 more
Add your answer

Q2. 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

Ans.

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.

Add your answer

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

Ans.

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

Add your answer

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

Ans.

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)

Add your answer
Discover Smash Elevators interview dos and don'ts from real experiences

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

Ans.

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

Add your answer

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 more
Ans.

Output 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

Add your answer
Are these interview questions helpful?

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 more
Add your answer

Q8. 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 more
Ans.

Given 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.

Add your answer
Share interview questions and help millions of jobseekers 🌟

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

Ans.

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

Add your answer
Q10. Design a streaming service similar to Netflix and explain how it onboard new content.
Ans.

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.

Add your answer

Q11. You have a huge linked list, how will you detect any loop in the linked list

Ans.

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

Add your answer

Q12. Formulate the angle between the hour hand and minute hand of the clock for any given time

Ans.

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

View 1 answer

Q13. Difference between BST and tries

Add your answer
Contribute & help others!
Write a review
Share interview
Contribute salary
Add office photos
Top Directi Interview Questions And Answers
Share an Interview
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
75 Lakh+

Reviews

5 Lakh+

Interviews

4 Crore+

Salaries

1 Cr+

Users/Month

Contribute to help millions

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter