Amazon | SDE II | Rejected | 4 YOE (Tier-1)
Summary
I completed a virtual SDE II interview at Amazon, solving the "Number of Atoms" coding problem and a Dive Deep behavioral question, but was ultimately rejected.
Full Experience
Applied for SDE II at Amazon. Virtual round (~60 min): 1 coding + 1 LP.
Coding: Number of Atoms (LC 726)
- Clarified input + edge cases, explained approach, then coded the stack-of-maps solution (push a map on "(", on ")" multiply popped map by the count and merge down, parse atoms + counts while scanning, sorted output via std::map). It worked.
- Interviewer kept pushing for the optimal solution. Stack-of-maps is O(n^2) due to repeated merges; I couldn't get to the better approach in time and ran out of time.
LP: 1 behavioral question (Dive Deep), standard STAR with follow-ups.
Verdict: Rejected
Interview Questions (1)
Number of Atoms
Given a chemical formula string containing element symbols, parentheses, and numeric multipliers, return a string that lists each atom followed by its count (if greater than 1) in lexicographically sorted order. The formula may include nested parentheses, and counts apply to the group inside the parentheses.
Example: Input: "Mg(OH)2" Output: "H2MgO2".