SDE-2 Interview Questions
- 0of 0 votes
AnswersDesign a simple rule engine system to route internal transactions to different bank. The engine should be flexible to extend to accept more parameters to make the routing decision.
- meghnabit December 23, 2021 in India
- The definition maintain in csv file, variable input and single result as output.
- The application is able to load the rule definition into proper routing.
- The match could be exact match or wildcar match. Exact match is preferred.
- The match priority from left to right is high.
simple rule definition
inputa, inputb, inputc, result
prod1, usd, us, b1
prod1, usd, * , b2
prod1, *,us, b3
prod1,*, ca, b4
Expection against sample rule definition:
sample1: [prod1,usd,us] -> b1
sample2: [prod1,usd,pr] -> b2
sample3: [prod1,eur,us] -> b3
sample4: [prod1,eur,pr] -> null
sample5: [prod1,usd,ca] -> b2
1. Define the data structure to hold the rule definition.
2. Implement the algorithm to do the routing.| Report Duplicate | Flag | PURGE
Amazon SDE-2 - 1of 3 votes
AnswersTell me about a time when you not just met your goals but exceeded the expectations
- yjagger1246 October 09, 2021| Report Duplicate | Flag | PURGE
Amazon SDE-2 Behavioral - 0of 0 votes
AnswersFor above question, asked to do coding in C Lang.
- mikela6 August 25, 2021 in India for forwarding team
He asked me what data structure to be used for storing employee records.
Then about the uses of arrays, hashmaps.
Which has more advantages if we want to search for a record with employee name?| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
AnswersAssume there are employee records with all required fields. like name, emp_id, manager_name etc..
- mikela6 August 25, 2021 in India for forwarding team
Write a SQL query to print the 2 employee names whose manager is same.| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
AnswersWhat is process synchronization, why do we need volatile keyword if we need to use mutex locks
- mikela6 August 25, 2021 in India for forwarding team| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 0of 0 votes
AnswersVolatile keywork --> what is the use of it, why compiler has to do optimizations, in which cases u have used volatile.
- mikela6 August 25, 2021 in India for forwarding team| Report Duplicate | Flag | PURGE
Arista Networks SDE-2 - 7of 7 votes
AnswerGiven a text file - find out all the unique words and display the frequency of each word in descending order.
- Ankit May 31, 2021 in India| Report Duplicate | Flag | PURGE
Kasheruka SDE-2 Problem Solving - 1of 1 vote
AnswersGiven a input string 'Hello World' and a input reference String, give count of each character (from refString) in the given string
- Ankit May 31, 2021 in India
Eg inputString: "Hello World Please", refString: "Help"
Output: H: 1, e: 3, l: 4, p: 1| Report Duplicate | Flag | PURGE
Kasheruka SDE-2 Problem Solving - 0of 0 votes
AnswersELK related questions especially on optimizing logging
- Mayank Dubey May 19, 2021 in India for Java| Report Duplicate | Flag | PURGE
Kasheruka SDE-2 - 0of 0 votes
AnswersDesign a Nearby shops features for online map service provider.
- Mayank Dubey May 19, 2021 in India for Java| Report Duplicate | Flag | PURGE
Kasheruka SDE-2 - 0of 0 votes
AnswersDesign a system to find top 10 sold products for an online website at any point of time for last 15 minutes.
- Mayank Dubey May 19, 2021 in India for Java
Which data structure & algorithm would be the best to design such kind of systems?| Report Duplicate | Flag | PURGE
Kasheruka SDE-2 Algorithm - 13of 13 votes
AnswersYou are given a directed cyclic graph represented by an adjacency matrix. The graph has at least one terminal node (i.e. the node with no outgoing edges).
Each edge of the graph is assigned a positive integer representing a probability of taking this edge. E.g. if you have 3 outgoing edges with numbers 3, 2, and 4, this means that the prob. of taking these edges are: 3/9, 2/9 and 4/9, respectively.
You need to find the probability of reaching each terminal node from the starting node 0.
Example:
adjacency matrix 5x5:m = {{0 1 0 0 1}, {0 0 3 2 0}, {4 0 0 1 0}, {0 0 0 0 0}, {0 0 0 0 0}}
so we have two terminal nodes here: 3 and 4
- pavel.emeliyanenko@toptal.com May 11, 2021 in United States
we can take the following paths:
0 -> 1 -> 3 = probability: 1/2*2/5 = 1/5
0 -> 1 -> 2 -> 3 = probability: 1/2*3/5*1/5 = 3/50
0 -> 1 -> 2 -> 0 -> 1 -> 3 ... and so on
or to the node 4:
0 -> 4: probability: 1/2
0 -> 1 -> 2 -> 0 -> 4: probability 1/2*3/5*4/5*1/2 = 3/25
and so on, summing up probabilities of all possible paths we get:
total probability to reach node 3: 13/38
total probability to reach node 4: 25/38| Report Duplicate | Flag | PURGE
Microsoft SDE-2 Algorithm - 1of 1 vote
Answersdesign an ip blocking system
- nitinthakur5654 March 05, 2021 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 design - 0of 0 votes
AnswersGiven an n-ary tree and some queries for the tree, in every query you’ll be given a node you are supposed to print preorder traversal of the subtree rooted at that node.
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 4of 4 votes
AnswersYou have an array of numbers. You have to give the range in which each number is the maximum element. For Example, If array is 1, 5, 4, 3, 6 The output would be
- neer.1304 July 12, 2020 in United States
1 [1, 1]
5 [1, 4]
4 [3, 4]
3 [4, 4]
6 [1, 5]| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswerGiven an array of billion of numbers. Billions of queries are generated with parameters as starting and an ending index. Both these indices lie within that array. Find the maximum number between these two indices in less than O(N)
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersMultiply two numbers without using * and only be using bitwise operations
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersDisplay nodes of a tree in level order using DFS
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersImplement a deque using stacks
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven the entire dictionary of English words, what data structure will you use to efficiently store and match the custom regex string like "D*sk", where * represents any single alphabet, and return the list of matched words?
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswerGiven a skewed tree, an insect is sitting at the root of the tree at t = 0min, every minute insect steps down in the tree, find the probability of the insect being at any node at t = infinity. Once I came up with a solution various other complexities has been added to the problem such as: What if the tree is binary tree (written code for this) What if three is n-ary What if it is now a directed acyclic graph Handle cases that there can be more than one entry point There can be more that one way to reach a node
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven a binary tree of numbers and a search number has given, find out first occurence of that number and smallest distance from root node. if you have given k search numbers find their occurence and nearest from root node in a single walk.
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven a string of numbers put commas so that it become readable like million trillion thousands. eg 1010503 ===> 1,010,503
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersGiven an array of 0s and 1s. find maximum no of consecutive 1s. If you have given chance to flip a bit to 1 such that it maximises the consecutive 1s. find out that flipped bit and after flipping that bit maximum no of consecutive 1s. Above question but you have options to flip k bits.
- neer.1304 July 12, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 0of 0 votes
AnswersDesign a system which will keep track of product and its inventory count. The service will expose two api incrCnt(int prodId, int cnt) and decrCnt(int prodId, int cnt). Which db would you use ? How will you handle hot products ?
- neer.1304 July 01, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 0of 0 votes
AnswerDesign a system in which read a file which has data and operation to be performed give a line by line. Ex a=5, next line b= 10, next line a*b. This design extended to support float, doubles, boolean, vector and complex numbers. Like if the file has a=5+i8, then how you handle such scenarios. How you will store and process data.
- neer.1304 June 08, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Software Design - 1of 1 vote
AnswersDesign content ingestion system
- kumar June 03, 2020 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2 System Design - 0of 0 votes
AnswersYou are given 2 arrays: one representing the time people arrive at a door and other representing the direction they want to go(in or out) You have to find at what time each person will use the door provided no 2 people can use the door at the same time. Constraints: the door starts with ‘in’ position, in case of a conflict(2 or more people trying to use the door at the same time), the direction previously used holds precedence. If there is no conflict whoever comes first uses the door. Also if no one uses the door, it reverts back to the starting ‘in’ position. Should be linear time complexity.
- neer.1304 April 21, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-2 Algorithm - 15of 15 votes
AnswersA startup website has a lot of real-time traffic . I want to see the real-time view (refreshed every 1 min) of top 20 users by hit count within last 10 mins. Full distributed system, I have to resolve all the concurrency issues.
- acharyashailendra1 December 22, 2019 in India| Report Duplicate | Flag | PURGE
Amazon SDE-2