Amazon SDE 2 Australia
Summary
I underwent the Amazon SDE 2 interview process for a role in Australia, which included an Online Assessment, a Phone Interview, and a Loop Interview consisting of multiple rounds, covering Data Structures & Algorithms, System Design, and Amazon Leadership Principles.
Full Experience
Online assessment :
Queation 1 :
don't remember
Question 2 :
In Amazon's highly efficient logistics network, minimizing operational overhead and optimizing package routing is crucial to ensure smooth deliveries across various regions.
The network consists of n warehouses, numbered from 1 to n, each strategically positioned at its corresponding index. Each warehouse has a specific storage capacity, given by warehouseCapacity, where warehouseCapacity[i] represents the capacity of the warehouse located at position (assuming 1-based indexing).
These warehouses are organized in a non-decreasing order of their storage capacities, meaning each warehouse's storage capacity is greater than or equal to the one before it. Each warehouse must establish a connection to a distribution hub positioned at a location greater than or equal to its own. This means that a warehouse at position ican only connect to a hub at position , where j> i.
To optimize inventory routing, Amazon has placed a central high-capacity distribution hub at the last warehouse, located at position n. This hub serves as the main connection point for all warehouses if necessary. The cost of establishing a connection from warehouse at ito a hub at position j is given by warehouseCapacity[] - warehouseCapacity[i]
Given q queries of the form (hubA, hubB), where two additional high-performance distribution hubs are deployed at warehouses hubA and hubB (1 s hubA < hubB < n), the goal is to calculate the minimum total connection cost for all warehouses, considering the nearest available distribution hub at or beyond each warehouse's position.
warehouses : 5 warehouseCapacity : 1 2 5 7 9
cost of connecting to warehouse no. 5 (1 based indexing) with warehouseCapacity of 9 without additional distribution hubs: (9-1) + (9-2) + (9-5) + (9-7) + (9-9) 8 + 7 + 4 + 2 + 0 21
queries (2, 4) (1, 3)
output: 3 5
explanation: when warehouse no. 2 (1 based indexing) with warehouseCapacity of 2 and warehouse no. 4 (1 based indexing) with warehouseCapacity of 7 become distribution hubs : (2-1) + (2-2) + (7-5) + (7-7) + (9-9) 1 + 0 + 2+ 0 + 0 3
when warehouse no. 1 (1 based indexing) with warehouseCapacity of 1 and warehouse no. 3 (1 based indexing) with warehouseCapacity of 5 become distribution hubs : (1-1) + (5-2) + (5-5) + (9-7) + (9-9) 0 + 3 + 0 + 2 + 0 5
Phone Interview :
Given a $$coinsDB$$ with different denominations, how many ways are there to form the given $$target$$ number
coinsDB : 1, 2, 5 target : 5 result: 4 1+1+1+1+1 1+1+1+2 1+2+2 5
Loop Interview :
Round 1
For a sequence of brackets arrange the brackets in following form:
[start_index_of_opening_bracket, end_index_of_closing_bracket, sub_array|None]
input: [[]][] output: [0,3,[1,2,None]],[4,5,None]
input: [[[]]] output: [0,5,[1,4,[2,3,None]]]
LP: Ownership and customer obsession
Round 2
there are two user's cart.
- logged in cart items (saved as linked list) aka serverCartHead
- logged out cart items (saved as linked list too) aka localCartHead when a user logs into the website, merge the two carts based on dateAdded in ascending order
""" class CartItem: product_id dateAdded next """
Similar to: Merge two sorted linked list input: 1->3->5 2->6 output: 1->2->3->5->6
LP: deep dive and Invent and Simplify
Round 3
Design video streaming service. Key features:
- Upload video
- Search video
- view video
- rate
- comment
- cataloging
LP: Insist on the Highest Standards
Round 4
LP: Deliver Results and Have Backbone, Disagree and Commit
only had LP questions.
Round 5
LP: Frugality and Bias for Action
In older model button phones you press 2,2,8 Give a list of suggestions for for all the words that could be formed and words that starts with them
input : 2,2,8 output : cat, bat, cattling, batman, ...etc
Note :
LP = Leardeship Principles https://www.levels.fyi/blog/amazon-leadership-principles.html
Interview Questions (6)
Minimum Connection Cost for Warehouses
In Amazon's highly efficient logistics network, minimizing operational overhead and optimizing package routing is crucial to ensure smooth deliveries across various regions.
The network consists of n warehouses, numbered from 1 to n, each strategically positioned at its corresponding index. Each warehouse has a specific storage capacity, given by warehouseCapacity, where warehouseCapacity[i] represents the capacity of the warehouse located at position (assuming 1-based indexing).
These warehouses are organized in a non-decreasing order of their storage capacities, meaning each warehouse's storage capacity is greater than or equal to the one before it. Each warehouse must establish a connection to a distribution hub positioned at a location greater than or equal to its own. This means that a warehouse at position ican only connect to a hub at position , where j> i.
To optimize inventory routing, Amazon has placed a central high-capacity distribution hub at the last warehouse, located at position n. This hub serves as the main connection point for all warehouses if necessary. The cost of establishing a connection from warehouse at ito a hub at position j is given by warehouseCapacity[] - warehouseCapacity[i]
Given q queries of the form (hubA, hubB), where two additional high-performance distribution hubs are deployed at warehouses hubA and hubB (1 s hubA < hubB < n), the goal is to calculate the minimum total connection cost for all warehouses, considering the nearest available distribution hub at or beyond each warehouse's position.
warehouses : 5 warehouseCapacity : 1 2 5 7 9
cost of connecting to warehouse no. 5 (1 based indexing) with warehouseCapacity of 9 without additional distribution hubs: (9-1) + (9-2) + (9-5) + (9-7) + (9-9) 8 + 7 + 4 + 2 + 0 21
queries (2, 4) (1, 3)
output: 3 5
explanation: when warehouse no. 2 (1 based indexing) with warehouseCapacity of 2 and warehouse no. 4 (1 based indexing) with warehouseCapacity of 7 become distribution hubs : (2-1) + (2-2) + (7-5) + (7-7) + (9-9) 1 + 0 + 2+ 0 + 0 3
when warehouse no. 1 (1 based indexing) with warehouseCapacity of 1 and warehouse no. 3 (1 based indexing) with warehouseCapacity of 5 become distribution hubs : (1-1) + (5-2) + (5-5) + (9-7) + (9-9) 0 + 3 + 0 + 2 + 0 5
Coin Change II - Count Ways to Make Target Sum
Given a $$coinsDB$$ with different denominations, how many ways are there to form the given $$target$$ number
coinsDB : 1, 2, 5 target : 5 result: 4 1+1+1+1+1 1+1+1+2 1+2+2 5
Bracket Sequence Structure Parsing
For a sequence of brackets arrange the brackets in following form:
[start_index_of_opening_bracket, end_index_of_closing_bracket, sub_array|None]
input: [[]][] output: [0,3,[1,2,None]],[4,5,None]
input: [[[]]] output: [0,5,[1,4,[2,3,None]]]
Merge Two Sorted Cart Linked Lists
there are two user's cart.
- logged in cart items (saved as linked list) aka serverCartHead
- logged out cart items (saved as linked list too) aka localCartHead when a user logs into the website, merge the two carts based on dateAdded in ascending order
""" class CartItem: product_id dateAdded next """
Similar to: Merge two sorted linked list input: 1->3->5 2->6 output: 1->2->3->5->6
Design Video Streaming Service
Design video streaming service. Key features:
- Upload video
- Search video
- view video
- rate
- comment
- cataloging
Phone Keypad Word Suggestions
In older model button phones you press 2,2,8 Give a list of suggestions for for all the words that could be formed and words that starts with them
input : 2,2,8 output : cat, bat, cattling, batman, ...etc