🇺🇸 Amazon Recently, OA has started to be sent in batches again. I received this Amazon OA on December 17th.
The test platform is HackerRank, with 2 coding questions. There is no behavioral aspect, and the whole process is hardcore.
The overall feeling is:
The question is not very specific, but the stem of the question is quite long and the logic is convoluted.
If you don’t read the questions carefully, you can easily go in the wrong direction from the beginning.
There is a lot of time pressure, so be sure to clarify the rules before writing code.
Below is a complete review of the two questions.

Question 1: Server Allocation + Cost Calculation
Summary of the question
- Give an array
Servers - The subscript indicates the server
- Array value representation The number of idle instances currently available on the server
There is now M customers, each customer In turn To rent a server instance, the rules are as follows:
- Every customer will choose The server with the most idle instances currently
- After selection, the number of idle instances of the server Minus 1
- Before "select", it will be generated once
Cost
Cost = in current server
Minimum number of idle instances
+ Maximum number of idle instances
Final requirements:
After the allocation of m customers is completed, the sum of all costs
Key test points
This question appears to be a simulation, but it actually tests:
- Priority Queue (Heap)
- Every step of the way Dynamic maintenance min/max
- Very easy to write as O(nm) direct timeout
Correct direction of ideas (not posting code, but giving ideas)
- Use a Max heap Maintain the server with the most idle instances currently
- Maintain one at the same time Min heap Or you can quickly get the current minimum value
- Each round:
- First read the current min + max → include in cost
- Then pop the maximum value, subtract 1 and push again
Pitfalls
- When multiple servers have the same idle number
- Whether it still participates in comparison after it is reduced to 0
- M may be greater than the total number of server instances (whether to continue selecting)
This question is quite Amazon-esque:
The rules are very long, but the real difficulty lies in "can you keep the state consistent?"
Question 2: Warehouses grouping + maximizing the minimum total half area
This question is obviously more difficult than the first question.Reading the question itself is the first threshold.
Breaking down the meaning of the question
Known:
- There are multiple
Logs- Each log has a corresponding Parts quantity
- Have
KWarehouses (K must be an even number)
Storage rules:
- Each warehouse Only parts from the same log can be stored
- Parts with the same log Can be distributed to multiple warehouses
- If the warehouse is not enough,There may be some log parts that cannot be stored
After storage is complete:
- Sort warehouses by number of parts stored
- First half (
0~k/2): Number of stored parts Most - Second half (
K/2~k): Number of stored parts Least
Target
Maximize: the total number of parts in the second half of warehouses
That is to say:
Instead of maximizing total storage,
Let the "worst half" be as good as possible
What is being tested on this question?
The essence is one:
- Resource allocation + sorting + greedy / binary / DP thinking
- Very similar to what Amazon often says: maximize the minimum / balance the worst case
Direction of thinking (interviewer expectations)
- You need to realize:
It doesn’t matter how much is stored in the first half of the warehouse
The key is how to "raise the floor of the rear part" - Common ideas include:
- Two-point answer (guess whether the minimum sum in the second half can be achieved)
- Greedy allocation of small blocks fills in the second half first
- Control how individual logs are split
This is the kind:
It doesn’t matter if you can’t finish writing the code, but the idea must be right
Why you need ProgramHelpOA real-time assistance?
After reading the above analysis, you may feel that you understand it. But under the high pressure of the actual OA countdown of 90 minutes, facing an IDE with HackerRank black background and white text, you can really guarantee:
- Bug-free: Write the Heap operation at once and handle the Edge Cases (for example, max becomes min after being reduced)?
- Reading Comprehension: Do you need to understand the tongue twister in question 2 within 5 minutes?
- Code duplication check: Will your code not be flagged for being exactly the same as the one on GitHub?
Don’t gamble with your Dream Offer.
High-End Services We Provide:
- Real-time screen share support: Our algorithm experts are connected to you in real time, we are watching while you are doing it. When encountering lag, direct voice/text prompts for ideas and codes.
- Original code guarantee: Every line of code is handwritten by us on the secondary screen, conforming to your coding style, and is definitely not an online copy-paste.
- All Cases Passed: Our goal is not just to be done, but to be completely green.
Recommended reading/exam preparation reference links:
👉 Amazon SDE OA full process review | High-frequency real questions + exam preparation suggestions explained in one go
📍 Comprehensive introduction to Amazon OA format, typical real questions and preparation strategies. It is a very good reference for you when writing Amazon interview.Amazon SDE OA full process review|High-frequency real questions + exam preparation suggestions explained clearly in one go
👉 Atlassian OA interview experience|ProgramHelp real experience of full voice assistance
📍A review of the actual use of ProgramHelp in Atlassian OA can be used as a reference case for "actual service effects".Atlassian OA interview experience|ProgramHelp real experience of full voice assistance
👉 Jump Trading SDE face-to-face experience sharing|ProgramHelp remote assistance to accompany you throughout the process
📍 A case study on how ProgramHelp assisted candidates in on-site and video/online interviews at fintech companies — with insights that are also useful for preparing quantitative or SDE interviews.Jump Trading SDE face-to-face experience sharing|ProgramHelp remote assistance to accompany you throughout the process