r/DSALeetCode • u/nian2326076 • 14h ago
Amazon new-grad SDE interview: train fares and a sliding-window maximum
An Amazon SDE new-grad candidate finished four rounds and got rejected. They left with mixed feelings. Some of the coding questions felt manageable, but nerves got to them during parts of the loop.
Leadership Principles and train fares
The first interview opened with about 10–15 minutes of Leadership Principles. The coding part asked for a function that returns the fare between two stops, at one unit per segment. For a route G → U → H → K → I, going from G to I costs four.
The candidate assumed a stops array already existed and wrote the calculation. They made a couple of small mistakes, including an incorrect edge-case return. When the interviewer asked where the array was coming from, they started modeling the route as a class and showing how stops would be added. Revising the solution midway got messy, and the interviewer brought them back to the fare function. They implemented the additional weekend cap. This was their weakest round, and they felt the missed modeling requirement mattered more than the typos.
String problem and GenAI
They came up with a solution to a string or substring problem and dry-ran it. When asked to write tests, they overthought the request until the interviewer gave a simple input/output example. They then wrote several cases, including empty input. The GenAI discussion also felt good. They considered this their strongest round.
For prep before another loop, try implementing and testing a problem from PracHub’s Amazon Interview Questions. If you’re applying to other teams, LandOffer can autofill repeated application fields. I work on both.
Behavioral
One question was about working with a difficult teammate or making a difficult decision. There were a lot of follow-ups. They felt some stories landed well and that they gave more background than needed on others.
Leadership Principles and sliding-window maximum
The last round started with a story about overcoming an obstacle to reach an important goal. The coding task was to implement put and getMax for the most recent k values. They started by keeping every insertion and scanning the last k when asked for the max. That gave them amortized O(1) inserts, O(k) queries and O(n) space.
When asked to reduce memory, they explained that they only needed the last k values and could evict the oldest as each new one arrived, bringing the space down to O(k). They talked through alternatives using arrays, hash maps, linked lists and heaps. They didn't get to the monotonic deque during the interview, but they had a working baseline and could explain the trade-offs. They left that round feeling reasonably good.
The final result was a rejection after all four rounds.