## SDE-2 Interview Questions

- 1of 3 votes

AnswersDesign an order tracking system using the below constraints.

- gauravkumar1491 September 07, 2017 in India

Once an order is received, it will be assigned to a delivery boy and sends notification at every stage of the order such as order received with expected time of delivery, delivery boy assigned, order picked up, order delivered.

State how your design will help scale and what will be the performance SLAs that will you will set for your design. The system should be able to horizontally scalable from hundreds of orders to million orders and should perform at almost the same level irrespective of the number of orders received.| Report Duplicate | Flag | PURGE

Amazon SDE-2 System Design - 2of 2 votes

AnswersSingleton Design pattern. How you make it double ton(in even call of getInstance() first object should be return and odd call of getInstance() second instance should be return). Make it triple ton.

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Goldman Sachs SDE-2 Software Design - 1of 1 vote

AnswersPrint series 010203040506. Using multi-threading 1st thread will print only 0 2nd thread will print only even numbers and 3rd thread print only odd numbers.

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Goldman Sachs SDE-2 Threads - 0of 0 votes

AnswersAdd a digit to a number that is represented by a linked list, where each node is a digit of the number. The linked list couldn’t be modified, except the digits to be modified in answer and the number could be infinitely long. Need to do it in O(1) space.

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 1of 1 vote

AnswersFind the Minimum length Unsorted Subarray, sorting which makes the complete array sorted

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 0of 0 votes

AnswersMaximum difference between node and its ancestor in Binary Tree in O(n) time.

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 0of 0 votes

AnswersGiven a very large binary number which cannot be stored in a variable, determine the remainder of the decimal equivalent of the binary number when divided by 3. Then generalize to remainder of any number 'k'

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 2of 2 votes

AnswersGiven a pre-order traversal, construct a binary search tree in O(n) time.

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswersGiven a large text file, find an efficient algorithm to find the least distance(measured in number of words) between any two given words.

- neer.1304 September 04, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswersGiven a set of start date and end date design a data structure to return a given date falls in.

- ASimpleCoder September 01, 2017 in India

Example

1Sep 2016 - 10 Sep 2016

1 Jan 2009 - 31 Aug 2015

given 12 Jan 2014 should return 1 Jan 2009 - 31 Aug 2015| Report Duplicate | Flag | PURGE

Yatra.com SDE-2 - 1of 1 vote

AnswersYou are given a text file. You have to return the list of starting index of the given word in text file. Design an efficient DS for that.

- neer.1304 September 01, 2017 in United States

Example :-

Text file content : “geeks for geeks”

word : “geeks”

List : {0,10}| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswersIn a file, there are two columns, first column has some word (String) and 2nd column has some value (Double).

- neer.1304 September 01, 2017 in United States

Example :-

ABC 23.4

ERF 34.89

WERT 122.9

Now user wants some arithmetic operations like

1) ABC + ERF = 23.4 + 34.89 = 58.29

2) ABC – WERT = 23.4 – 122.9 = -99.5

Design an efficient DS for these kind of operations.| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswersThere are n Thread , n/2 thread are producer and n/2 are consumer, number produced by producer-1 thread must be consumed by consumer-1 thread. Thread must also run in order, producer 1, then consumer 1, again producer 2 and then consumer 2…so on…..

- neer.1304 August 31, 2017 in India| Report Duplicate | Flag | PURGE

One97 SDE-2 Algorithm - 0of 0 votes

AnswerImplement function which add n days to given date without using inbuilt library.

- neer.1304 August 31, 2017 in India| Report Duplicate | Flag | PURGE

One97 SDE-2 Algorithm - 0of 0 votes

AnswersYou are given a set of N horizontal lines which are connected by equal number of vertical lines to form squares of size 1x1. Now some segments are removed. You need to count the number of squares of all sizes (1x1, 2x2, ..., NxN) with all sides present.

- imunique August 30, 2017 in India

Image : https://he-s3.s3.amazonaws.com/media/uploads/1ce3516.png

In the above example you see four horizontal and vertical lines and few missing segments. Now you need to count the number of squares of all sizes with all sides.

Input :

First line is a positive integer N, number of horizontal and vertical lines.

Second line is positive integer M, number of segments removed.

Then there are m lines, each containing V,i,j or H,i,j where i and j are positive integers. H,i,j indicates a horizontal missing segment in the ith horizontal line between the jth and (j+1)th point on the line. V,i,j represents a gap in ith vertical line between the jth and (j+1)th point on the line.

Output :

Is the total number of squares in the figure with all sides along the remaining lines in the figure.

Sample Input :

4

4

H,2,1

H,3,1

V,2,2

V,2,3

Output :

5

Explanation : Here in this figure we have 4 squares of size 1x1 and 1 square of size 3x3, hence total is 5.| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm Data Structures Dynamic Programming Online Test Problem Solving - -1of 1 vote

AnswersIn a Kafka configuration, the same message is getting replayed to the consumer again n again.This is happening under heavy load otherwise it's fine.What can be possible causes?

- koustav.adorable August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Spotify SDE-2 Distributed Computing - 0of 0 votes

AnswersGiven data of millions of people, (name, age, M/F etc.) Develop an API that will have age range as input and yield the count of people under this range as output.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 1of 1 vote

AnswerA T20 match is going on. You’re in Team B. First innings is over, they have scored “teamARuns” runs. Your team has scored “teamBRuns” runs at the end of “balls” balls. A ball can have multiple possibilities like [0, 1, 2, 3, 4, 5, 6, Wicket, No ball, Wide ball]. What is the probability that your team (Team B) will win?

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 0of 0 votes

AnswersGiven a dictionary of words and a string pattern. Output the count of words that match the string pattern in the dictionary.

- neer.1304 August 30, 2017 in United States

Eg. Dictionary: [cat, rat, mat, apple, boy, bat]

String pattern: ?at

Output: 4 (because cat, rat, mat, bat matches the string pattern)| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 0of 0 votes

AnswersGiven any two nodes in a binary tree, find the path from 1st node to another, and tell if the path is a straight line, or there are turns on the line, find number of turns.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 0of 0 votes

AnswersFind the maximum difference between any combination of child and parent node in a given binary tree. Here child node can be any level below parent node, but should be in the same sub tree starting from parent node.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 1of 1 vote

AnswersDesign Truecaller. Both HLD and LLD.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 design - 0of 0 votes

AnswersGiven a chessboard, find minimum number of moves for a knight to reach from source to destination.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 0of 0 votes

AnswerGiven a fully connected graph with n nodes and corresponding values. One node can interact with other node at a time, to replace/ignore/add its value to other node’s value. Assuming this operation takes 1 unit of time, how much time would it take for all the nodes to have value equal to sum of all the nodes.

- neer.1304 August 30, 2017 in United States

Examples : Given a graph with values {1,2,3,4}, find total time it takes, such that all nodes have value as 10.| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 1of 1 vote

AnswersGiven a Singly Linked list, Update the second half of the list such that n-th element becomes sum(1st + nth) element, (n-1)st element becomes sum(2nd + n-1st) element and so on. Eg: 2->3->4->5->6 => 2->3->(4+4)->(5+3)->(6+2)

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Amazon SDE-2 Algorithm - 1of 1 vote

AnswersImplement a queue using only one stack.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswersIt’s a two player game. Both the players are equally intelligent to win the game. Give n no. of stones. A player can choose either 1 stone or k stones or l stone (1<k<l). Suppose player 'A' starts game then challenge was to identify the player who will win the game. Player who picks the last 1 stone or last k stone or last l stones win the game.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswerDesign bus booking system:- Each row has x seat. If customer wants K seats if you have K consecutive seats available, reserve them. Otherwise give seats from any row.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswersThere is a bridge and N no. people takes (a1,a2,—an) time to cross it and there are K torch and at any time x no of people can pass the bridge and it takes maximum of x people time to cross it. Minimum time required for N persons to cross the bridge.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm - 0of 0 votes

AnswerThere is a graph where each node represents a city and it contains specific no. of people. A tournament is going on and each match is playing in one city. All city’s people gather to watch match. Traffic department wants to manage how many people travel through city x if match is playing in city y for each x. City x and y can be any city.

- neer.1304 August 30, 2017 in United States| Report Duplicate | Flag | PURGE

Microsoft SDE-2 Algorithm

**CareerCup**is the world's biggest and best source for software engineering interview preparation. See all our resources.

Open Chat in New Window