Amazon (virutal) Onsite SDE1/2 (Rejected)
Anonymous User
2609

YOE: 6-ish
Education: Master's in CS from a reputable research institution, where I focused on AI and ML in computer vision.
Prep: Leetcode 50ish questions, primarily in the medium difficulty.

Finally had my first interview and was excited to come back here to contribute! Overall my experience was similar to other interviews posted here, but I over-prepared on LP questions. I was able to just speak naturally from my experience and there was only one question I really struggled with, YMMV. I won't go into much detail on those because they seem like they could ask about anything. Have some stories ready to go in your back pocket for sure. I did the whole thing in Python because I'm a pleb.

R1: Create a filtered list of movies from a collection and a string query (e.g., "year > 2009 and rating > 85 and !prime"). I knew that I needed a parse tree but I just hadn't done anything quite like that since undergrad. The interviewer instructed me to pretend I had a magic function capable of producing the parse tree I wanted, but I still needed to be able to explain how the parse tree should be structured. I was also required to show how I would perform the operations, and I had to evaluate the final query from the tree. Full disclosure, I bombed this pretty hard, but the interviewer was really nice and helped me through it so it wasn't totally humiliating (my greatest fear). Post-interview, I went back and made this myself and it really wasn't that hard, especially for the steps he wanted me to perform. Converting from string ops to logical ops is extremely easy and for some reason I got psyched out here. In python you can define a neat enum like

# Call this like Op.op[op](l, r)
class Op(Enum):
	def AND(l, r): return l and r
	....
	
	self.op = {"AND", AND
				...}

Maybe there is an even cleaner way, would be curious to hear from the community. Once you have your parse tree, you can evaluate it quite easily with pre-order traversal, and simply pass the evalution of expressions up to the root, e.g.,

def _dfs(root):
	if root is None:
		return
		
	op = root.val
	left = _dfs(root.left)
	right = _dfs(root.left)
	
	if left is not None and right is not None:
		return Op.op[op](left, right)
	
	# if not an expression, return the non-string value for left/right, etc
	...
	# Ex: return movie[left]

You can find DFS problems like that a dime a dozen on leetcode. The examples in the intial problem didn't use any (), so maybe I could have gotten away with just parsing left to right and then discussed the parse tree briefly, but I knew that wasn't the best answer. I suspect if I had done well here, there would have been some discussion about how I would modify the parse tree to support more operations/syntax.

R2: Only LP questions. I spoke with the division manager. He was really nice and we connected well. I noticed that there was a heavy emphasis in all my interviews on any experience I had when deadlines were missed or very close.

R3: Tic Tac Toe. I had a measurable decrease in my pulse after the first question, and perhaps I got a little too relaxed. This went really well but I forgot that when you check for the win conditions, you only need to check along the row/column/diagonal where the last move was made, which is O(N). If you check every win condition every time (like my dumb ass) then you have O(N**2). This was my only interview where I felt like my interviewer wasn't interested in engaging with me at all, and that was pretty frustrating.

R4: Music Playlist for a party: the scenario I was given is that you are throwing a party but you have zero confidence in your playlist. To address this, you want to create an app that grabs playlists from your guests and appends them to your playlist, and always plays the next most played song. I thought I did well here - you don't have to sort the whole list, you only have to find the next most played song which is O(N) worst case. I was able to discuss some further optimizations and some extensions to this problem. I thought this round went especially well, unless there's some solution here that I missed.

Overall I thought I did really well except on round 1. This was my first 'big' coding interview despite having quite a bit of experience, so I went into round 1 extremely nervous. Part of that was because I spent some time on this site and read some questions I felt I woudln't be able to answer, so I definitely got into my own head. A major issue I had in this virtual interview is that I suck using a mouse for the whiteboard application. I do really well drawing out the problems, and those illustrations often keep me from making stupid mistakes like I did on the tic tac toe problem. I have considered investing in a standing desk and a normal whilteboard so I can have a more comfortable setup. Otherwise, I think I will continue to practice here for my next interview.

Comments (3)