Amazon Interview Questions
- 0of 0 votes
AnswersThe Unix find command allows you to search for files under a given directory. You can specify criteria for files you are interested in.
- ajangir August 08, 2022 in India
Imagine that you need to write code in a high level language like java, that does things similar to the find command.
I would like you to focus on 2 uses cases at first.
• Find all files over 5 MB somewhere under a directory.
• Find all XML files somewhere under a directory.
I would like you to create a library that lets me do this easily. Keep in mind that these are just 2 uses cases and
that the library should be flexible.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Software Design - -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 - 2of 2 votes
AnswersGive m balls and n bins. Find out how many ways to assign balls to bins. Notice the buckets has no order. Like (1,2,3) and (3,2,1) are considered the same.
- acoding167 May 16, 2019 in United States
eg, m = 3, n = 2, return 2. (1, 2) and (3, 0)| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswerGiven items as Shirt, Trouser, Shoes, Tie, Belt, Shocks, and dependencies as -
- alisonlee659 May 15, 2019 in United States
Tie can be worn after Shirt
Belt can be worn after Shirt and Trouser
Shocks can be worn after Trouser
Shoes can be worn after Shocks
Find various orders in which the activity of wearing clothes can be completed.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 1of 1 vote
AnswersGiven a List of Nodes, with each Node having an ID and a parent ID, determine whether the List is given in preorder.
- acoding167 May 07, 2019 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 1of 1 vote
AnswersFind the indices of all anagrams of a given word in a another word.
- aonecoding4 February 19, 2019 in United States
For example: Find the indices of all the anagrams of AB in ABCDBACDAB (Answer: 0, 4, 8)| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 1of 1 vote
AnswerGiven a series of equations e.g. [A = B, B = D, C = D, F = G, E = H, H = C]
- aonecoding4 December 25, 2018 in United States
and then another series [A != C, D != H, ..., F != A ]
Check whether the equations combined is valid.
For the example given, your program should return 'invalid', because the first series implies that A = C, which contradicts the statement A != C in the second series.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 2of 2 votes
AnswersGiven a binary tree, find the closest LEAF node to the target.
- aonecoding August 24, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersGiven a random MxN matrix and a positive integer, recursively Your program should then find a continuous path thought the matrix starting at position 0,0 that will sum to n. Your program shouldomly move left (col -1), right(col +1), up (row -1) and down (row+1)and can only use a position once in the sum. if there is a such path in the matrix, create the path in a separate matrix with the same size, and replacing the indices used with 1 and the rest 0.
- stingerviii June 02, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 2of 2 votes
AnswersAWS phone interview
- aonecoding May 13, 2018 in United States
Find the left view of binary tree
1
/ \
2 3
/\ \
4 5 6
/ /
7 8
/
9
return [1, 2, 4, 7, 9]| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 1of 1 vote
AnswersWrite a method that can take in an unordered list of airport pairs visited during a trip, and return the list in order:
- mandy May 08, 2018 in United States
Unordered: ("ITO", "KOA"), ("ANC", "SEA"), ("LGA", "CDG"), ("KOA", "LGA"), ("PDX", "ITO"), ("SEA", "PDX")
Ordered: ("ANC", "SEA"), ("SEA", "PDX"), ("PDX", "ITO"), ("ITO", "KOA"), ("KOA", "LGA"), ("LGA", "CDG")| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
Answers/**
* Definition for a binary tree node.
* public class TreeNode {
* int val;
* TreeNode left;
* TreeNode right;
* TreeNode(int x) { val = x; }
* }
*/Find the largest duplicate subtree in a binary tree For example, 1 / \ 2 3 / / \ 4 2 4 / 4 The following are two duplicate subtrees: 2 / 4 and 4
but the former is the largest, thus return the root of the first subtree
- ajay.raj May 05, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersGiven a target string, an input request replaces the word after the given index a->b such as:
- ajay.raj May 04, 2018 in United States
Target string: "Hello world!"
Input:{s:0, a:Hello b: Goodbye}
Output:"Goodbye world!".
The requirement is that input be given to several words that need to be changed at one time: {{s:0,a:Hello,b:Goodbye},{s:11,a:!,b:?},{s:6 a: World,b:friend}}
And each modified index is based on the original unmodified target string so the end result is
"Goodbye friend?"| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
Answersgiven a n-ary tree, find the total distance from this node to any other nodes
- ajay.raj May 04, 2018 in United States
class TreeNode {
int val;
List<TreeNode> children;
TreeNode(int val) {
this.val = val;
children = new ArrayList<>();
}
}
public int findDistance(TreeNode root, TreeNode node) {
}| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
Answerfind max path sum in DAG, weight can be negative
- ajay.raj April 06, 2018 in United States| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersGiven an Input file of IPv4 addresses, filter and write them into Valid and Invalid IPs.
- pragramticProgrammer March 28, 2018 in United States
Input file = ["192.100.0.1, "10.0.0.1", "aa.bb.cc.dd", "10.0", "999.10.10.1"]
Valid = []
Invalid = []| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersWrite a simple RegEx parser function that handles only the
- ajay.raj March 04, 2018 in United States
operators * (0 or more) and + (1 or more), and returns true if
the provided string is a match. Signature:
boolean isMatch(String regex, String input).
Example: regex = a*b+ce, input = bce, return true
Example: regex = a*b+ce, input = ace, return false
Example: regex = a*b+ce, input = abcee, return false| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersGiven a tree and a number N,
- ajay.raj March 04, 2018 in United States
construct another tree such that each node of the tree has either 0 or
N elements,except for one node which has between 0 to N elements.
Only other constraint is
that ancestry is preserved in the new tree.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
Answersgiven start and end of a given set of meetings, asking how to schedule
- ajay.raj March 04, 2018 in United States
as many meetings as possible。| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 4of 4 votes
AnswersAmazon
- aonecoding January 06, 2018 in United States
Given an ArrayList of Nodes, with each Node having an ID and a parent ID, determine whether the List is given in preorder.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 2of 2 votes
AnswersFind the indices of all anagrams of a given word in a another word.
- aonecoding October 09, 2017 in United States
For example: Find the indices of all the anagrams of AB in ABCDBACDAB (Answer: 0, 4, 8)| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 2of 2 votes
AnswersPhone Interview Amazon, Seattle
- aonecoding July 28, 2017 in United States
I. Get the sum of all prime numbers up to N. primeSum(N).
Follow-up: If primeSum(N) is frequently called, how to optimize it.
II. OODesign Parking Lot| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm - 0of 0 votes
AnswersI've got these trees of integers; they're like regular trees, but they can share nodes.
- NinjaCoder July 20, 2017 in United States
I need to know if any branch of this tree sums to 100.
7
/ \
8 6
/ \ / \
2 3 9
/ \ / \ / \
5 4 1 100
Follow up question was how would you change the code to handle negative numbers.| Report Duplicate | Flag | PURGE
Amazon Software Engineer Trees and Graphs - 0of 0 votes
AnswersImplement power function. The function should take two numbers as input (e.g. 2,3) and return 8 as output
- Syed May 22, 2017 in India
See link below for hints and answer https://baquerrizvinotes.blogspot.in/2017/05/how-to-crack-amazoncom-technical.html| Report Duplicate | Flag | PURGE
Amazon Software Engineer Coding - -1of 3 votes
AnswersAmazon SDE 2 On-site (4 of 4 Rounds)
- aonecoding April 23, 2017 in United States
Assume that there is an e-book application. For every book the sharable part of the book content cannot exceed 10% of the whole book. Design a module to decide whether the current part of content is sharable.
The description given is vague. I had to push him with questions to give the details.
At first I thought the problem was about strStr. But then the interviewer said that even if there are two paragraphs of the book content with the exact same texts, as long as they are not in the same place, they would be considered different content.
I then realized it’s a question about merging segments - have a helper to find each pair of start and end point of the input content (given multiple separated paragraphs). Then merge the intervals and see if they combined exceed 10% of the entire book.
The interviewer approved my solution and ask me to code it.
Overall I feel like that the Amazon SDE II Interview doesn’t focus on just algorithm. It’s more about problem solving in practice and then implement the only core function on whiteboard.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersWrite code for the following: given a text file containing this information (Date the customer is logged in, tab, customer id)
- aifra2000 April 18, 2017 in United States for Amazon Alexa
04/11/2017 /t 0003
04/12/2017 /t 0003
04/13/2017 /t 0004
04/13/2017 /t 0003
How to get the list of those customers that log in on three consecutive days.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersOOPS: How to design Amazon locker? Provide code using OOP
- aifra2000 April 18, 2017 in United States for Amazon Alexa| Report Duplicate | Flag | PURGE
Amazon Software Engineer - -1of 1 vote
AnswersHow to merge two binary trees in place? (without creating a new node)
- aifra2000 April 18, 2017 in United States for Amazon Alexa| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
AnswersIf a string is matched to any filter, it is in the black list, otherwise not.
- ajay.raj February 23, 2017 in United States
Design a data structure and implement following two functions.
addFilter(filter)
isInBlackList(string)
filters are in the form of
“a*b”
“abc”
“aa*b”
having at most one star, which matches 0 or more chars.| Report Duplicate | Flag | PURGE
Amazon Software Engineer - 0of 0 votes
Answerslist1 -->aaa,bbb,ddd,xyxz,...
- codemarathon February 09, 2017 in United States
list2-->bbb,ccc,ccc,hkp,..
list3> ddd,eee,,ffff,lmn,..
Inside a list the words are sorted
I want to remove words which are repeated across the list and print in sorted order
If the words are repeated in same list its valid.
In the above case
it should print aaa-->ccc-->ccc-->eee--->fff-->glk-->hkp-->lmn-->xyxz| Report Duplicate | Flag | PURGE
Amazon Software Engineer Algorithm