Amazon | SDE 2 | Bangalore,India | Reject
Summary
I interviewed for an SDE2 position at Amazon in Bangalore, India, and was rejected after the second round of virtual interviews. My struggle with a challenging Dynamic Programming problem was a key factor in my rejection.
Full Experience
I'm a Software Engineer with over 3 years of experience from Nagarro, India, holding a B.Tech from a Tier 1 CS College. I recently interviewed for an SDE2 position at Amazon in Bangalore, India, on March 18th, 2020. Unfortunately, my journey ended after the second round of virtual interviews.
My virtual interviews began with Round 1, which featured three technical questions:
- The first question involved printing the right view of a binary tree. I approached this using BFS, specifically by printing the tail of the queue (represented as a list) at the start of each iteration.
- The second problem was a two-part matrix hop challenge. The initial part asked to determine if an end position could be reached from a start position in a 2D array by moving exactly 'k' distance at once in one of four directions, seeking an O(1) mathematical solution. The second part was a variation where the 2D array included marked positions that acted as obstacles, and for this, I suggested a BFS approach from start to end.
- Finally, I was presented with the Word Break problem. While I wasn't required to write code, I explained a brute-force solution first, then elaborated on how to improve its efficiency using memoization, which the interviewer found satisfactory.
I proceeded to Round 2, but this is where my interview process concluded. This round also had two questions:
- The first question was quite challenging: given an array of colors, I had to select the maximum number of items under specific conditions. I could only select two positions at once if they had the same color, and a pair could only be selected if a pair outside it had already been selected (except for the outermost pair). I identified it as a Dynamic Programming problem but, acknowledging my weakness in DP, I struggled to provide a concrete solution.
- The second question was a "pity question" as I perceived it, likely given due to my struggle with the first: Climbing Stairs. I solved it with O(n) time and O(n) space complexity. The interviewer then prompted me to optimize space, which I achieved in O(1). When asked if I could recognize the pattern (Fibonacci) and if a solution faster than O(n) was possible, I admitted I didn't know.
After Round 2, the interviewer consoled me, and I had a strong feeling I hadn't made the cut. Shortly after, I received an email cancelling my third round, followed by an official rejection email the next morning. It was pretty much my first interview after college, and it taught me a valuable lesson.
Interview Questions (6)
Given a start and an end position in a 2D array, determine if it's possible to reach the end from the start. The constraint is that you can only move exactly 'k' distance at once in one of the four cardinal directions (up, down, left, right). The interviewer was looking for an O(1) mathematical solution.
This was a variation of the previous problem: given a 2D array with marked positions that are obstacles (you cannot jump to them), find if you can reach the end from the start, moving 'k' distance at once in one of four directions.
Given an array of colors (e.g., R B G B G B R B), select the maximum number of items subject to two conditions: 1. You can only select two positions at once, and they must have the same color. 2. You can only select a pair if a pair outside this pair has been selected (except for the outermost such pair). Example: R B G B G B R B. One solution is 6 (R B G G B R), another is 4 (B G G B, B B B B). The goal is the maximum.
Preparation Tips
I started my preparation in January 2020. I primarily focused on practicing on LeetCode, which I found surprisingly enjoyable compared to my college days. I realized during this interview that Dynamic Programming was a significant weakness for me, and I need to intensify my efforts in that area.