Amazon Interview Questions
- 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
AnswerFind min number of jumps it will take to reach to the top in snake and ladder game using recursive function
- theshowtimebuzz29 June 02, 2020 in India| Report Duplicate | Flag | PURGE
Amazon Software Developer - 0of 0 votes
AnswersDesign a distributed key-value store that can perform the following
- neer.1304 May 27, 2020 in United States
Store a set of attributes (value) against a particular key (k)
Fetch the value stored against a particular key (k)
Delete a key (k)
- Perform a secondary index scan to fetch all key along with their attributes where one of the attribute values is v.
Key can have a value consisting of multiple attributes.
Each attribute will have name, type associated (primitive types - boolean, double, integer, string) & type has to be identified at run time.
Ex -
1) Key = delhi has 2 attributes ( pollution_level & population)
2) Key = jakarta has 3 attributes (latitude, longitude, pollution_level)
3) Key = bangalore has 4 attributes (extra - free_food)
4) Key = india has 2 attributes (capital & population)
5) Key = crocin has 2 attributes (category & manufacturer)
Example of Secondary index:
Get all keys (cities) where pollution_level is high. Get all medicines by manufacturer (GSK)
So, in a nutshell, value must be strongly typed when defined.
Attribute
1. Attribute is uniquely identified by its name (latitude, longitude etc.
2. Data type of the attribute is defined at the first insert. (i.e. data type of pollution_level is set when key = delhi is inserted)
3. Once data type is associated with a particular attribute, it cannot be changed.
(i.e. free_food when defined takes type = boolean, hence, any key when using the attribute - free_food must allow only boolean values on subsequent inserts/updates)
Non-functional requirements
Highly scalable - Support for high throughput with very low latency
Highly available
Shared nothing architecture i.e. Support for Multiple nodes and each node is independent & self-sufficient.
Stretch - Smart client i.e. clients being aware of available servers & makes smart routing based on that available information.| Report Duplicate | Flag | PURGE
Amazon Principal Software Engineer Computer Architecture & Low Level - 0of 0 votes
AnswersDesign twitter trending topics feature to show trending topics in past 24 hours.
- neer.1304 May 24, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Computer Architecture & Low Level - 0of 0 votes
AnswersGiven a binary matrix of size M * N. You are given H and V where H denotes the number of horizontal cuts and V represents number of vertical cuts. You need to find whether you can make H and V amount of cuts such that each submatrix formed after the cuts will have equal number of 1. E.g.
- neer.1304 May 16, 2020 in United States
4 5
1 1 1 1 1
0 0 1 1 1
0 1 1 1 1
1 0 1 1 1
Given H=1 and V=3, we can make 1st horizontal cut after 2nd row and 3 vertical cuts after 2nd, 3rd and 4th column such that each of the sub matrix will have equal number of 1s.
| ----------------|
| 1 1 | 1 | 1 | 1 |
| 0 0 | 1 | 1 | 1 |
| ----------------|
| 0 1 | 1 | 1 | 1 |
| 1 0 | 1 | 1 | 1 |
| ----------------|| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersGiven a remote having 0-9 digits, plus button (to increase channel), minus (to decrease) and previous channel button (to go to previous channel). We were given 2 numbers stating start and end channel number and an array having various channel numbers. The task is to go to all channel numbers given in array with minimum number of clicks.
- neer.1304 May 16, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Algorithm - 0of 0 votes
AnswersI was asked the following question in an interview recently, which was a lot more vague and after asking clarification questions came down to this:
- randomCoder May 13, 2020 in Canada
```
We have to perform N tests [1, 2, ... N] but in randomized order.
We have access to two functions test(x) and rand(x) which both take an integer.
test(x) returns if the current test was succesful or not and rand(x) returns a random integer
from 1<= rand(x) <= x.
The tests fail because of the sequeunce of tests carried out and we want to figure out which
sequences are bad and which sequences are good.
Basically our task is to generate a sequence of test while carrying them out and return the
sequence either when the test failed or when all tests are done.
```
I understand that the problem could be simplified by calling rand(N) just once, say x = rand(N) then we get the xth permuation of the seuence (1...N) and then call the test() function on this sequence reutrning only the part of sequence that finished successfully, this is deterministic and can be done in O(N) time.
Is there a better approach / solution in Python?| Report Duplicate | Flag | PURGE
Amazon Software Developer Python - 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 - 0of 0 votes
AnswersA 2d array has 0 and 1 as values. In one flip, 0's are changed to 1 if and only if any of the neighbors (left, right, top, bottom) is 1. Return the total number of flips required to convert the whole grid to 1's
- abhi.mathur.us February 11, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon SDET - 1of 1 vote
AnswersGiven an unsorted array A of size N of non-negative integers, find a continuous sub-array which adds to a given number S.
- Nits January 30, 2020 in United States| Report Duplicate | Flag | PURGE
Amazon Dev Lead - 0of 0 votes
AnswersProblem:
- giridharikhandelwal1 January 03, 2020 in India
1. Given a Mix of all types of characters which includes Special characters, Numbers, String in a Log file.
for eg: "HappyI%&&87Christmas %%$^%&NewYear"
2. Get the largest substring which
"contains the Characters in Even Position followed by a Special Character and
then a meaningful word should be coming up"| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Problem Solving - 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 - 4of 4 votes
AnswersPrepare test plan for a new feature of " deposit cheque via mobile app " which is added under menu tab.
- raghunath.e November 14, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test test - 2of 2 votes
AnswersWrite a function to return string when passed integer . Note : do not use tostring() in built function.
- raghunath.e November 14, 2019 in United States
E.g 123 --> "123"| Report Duplicate | Flag | PURGE
Amazon Software Engineer in Test technical - -2of 2 votes
AnswersGiving a the following:
- xi.text.xi October 22, 2019 in United States for none
A list of a store items T={t_1, t_2,...,t_n}.
A list of prices of each item P={p_1, p_2,...,p_n}.
A list of quantities of each item Q={q_1, q_2,...,q_n}, respectively.
And total bill M.
Our goal is to find any possible list of items that its total value is equal to M using dynamic problem.
Write down a recursive solution.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersGiven an array of positive and negative integers {-1,6,9,-4,-10,-9,8,8,4} (repetition allowed) sort the array in a way such that the starting from a positive number, the elements should be arranged as one positive and one negative element maintaining insertion order. First element should be starting from positive integer and the resultant array should look like {6,-1,9,-4,8,-10,8,-9,4}
- sameerasusmitha October 21, 2019 in India| Report Duplicate | Flag | PURGE
Amazon Quality Assurance Engineer Arrays - 1of 1 vote
AnswerDesign a service to scan photos/videos for any malware
- novastorm123 October 16, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon System Design - 0of 0 votes
AnswersWrite a method that merges a fixed number of streams containing an infinite sequence of monotonically increasing integers into an output stream of monotonically increasing integers. It is important to note that the input stream are infinite, so any solution based on the length of the streams would be considered incorrect.
Note that the question was given in the context of Java with the below code given as the base contract for the method.public void merge(List<Stream> inputStreams, Stream outputStream) { // Implement me }
This was also provided as the definition of "Stream" in this case, and not what is defined in java.util.stream.Stream.
- gr1ml0ck October 05, 2019 in United Statesinterface Stream { // Retrieves but does not remove the next item from the stream int peek(); // Retrieves and removes the next item from the stream. int poll(); // Puts an item into the stream void put(int i); }
| Report Duplicate | Flag | PURGE
Amazon Solutions Engineer Algorithm - 0of 0 votes
AnswersWrite test cases for earring with diamond, gold clamp, diameter 13mm, width 4mm
- roman.khomitsky19 October 05, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Testing / Quality Assurance - 0of 0 votes
AnswersImplement union and intersection of two array(in a efficient way).
- dhruvjoshi43 October 04, 2019 in india for none
Additional information given by the interviewer was: elements of the two given array may be repeated but cannot be repeated in union and intersection array.| Report Duplicate | Flag | PURGE
Amazon Data Engineer test - 0of 0 votes
AnswersA co-ordinate plane was given. On each point (x, y) there are x+y number of apples on it. A person is standing on (0, 0) and he wants to buy a square plot having N number of apples inside it (including the periphery). Question was to return the value of perimeter of that square plot given N.
- 200MITTALGAUTAM August 26, 2019 in India| Report Duplicate | Flag | PURGE
Amazon SDE1 - 0of 0 votes
AnswersDesign distributed crawling system which would be feeded a source url.
- neer.1304 August 09, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Distributed Computing - 1of 1 vote
AnswersGiven 'n' servers each having millions of sorted integers. Find distributed median of all the 'n' servers.
- neer.1304 August 09, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon SDE-3 Distributed Computing