Amazon | OA | Get Heaviest Package, Maximum Cluster
Anonymous User
10396

https://leetcode.com/discuss/interview-question/1759164/Amazon-or-OA-or-Get-heaviest-package

https://leetcode.com/discuss/interview-question/1636493/Amazon-or-OA-or-Max-Length-of-Valid-Server-Cluster

Passed all test cases. Hopefully not too fast because I had seen the problems before lol

For 1. Started from the back and popped off numbers combining them with a stack O(n)

For 2. Use a sliding window with a deque to get the max (The back stores the numbers less than max and the front holds the max, when adjusting the left remove the front if the index matches) O(n)

Same idea as https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit/

Updated: Passed to onsite interview, took about 4 days to hear back I know it depends on how backed up the recruiters are. Heard back via phone call first then email later.

Comments (17)