Amazon interview experience Real time questions & tips from candidates to crack your interview

SDE - Intern

Amazon
upvote
share-icon
2 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Journey
I was first introduced to DSA during my B.Tech, though I mostly focused on the basics at that time and didn’t dive into advanced topics like dynamic programming, graphs, or trees. When I started my Master’s, I decided to take it more seriously. Being surrounded by highly motivated and intelligent peers pushed me to improve and challenge myself. Their support and healthy competition helped me strengthen my skills, and this journey from the basics to a deeper understanding eventually prepared me to confidently tackle challenges.
Application story
It was an on-campus opportunity, so we applied through the Superset platform. We also applied on the careers page, after which we received the OA link.
Why selected/rejected for the role?
Although the question was easy, I could not communicate my approach well. Doing a dry run of my code step by step and explaining it was relatively difficult, as it was my first online interview.
Preparation
Duration: 1 Year
Topics: Trees, Heap, Dynamic Programming, Graphs, Stack
Tip
Tip

Tip 1: Most companies ask questions directly from popular SDE sheets in interviews, so revise those questions repeatedly.

Tip 2: If you're comfortable with all the topics, try solving random medium-level problems from coding platforms. Initially, you may struggle, but over time you will be able to solve unfamiliar problems and identify patterns, which will help you prepare for OAs.

Tip 3: Participate in weekly and biweekly contests on different coding platforms.

Application process
Where: Campus
Eligibility: 6.5 CGPA (Salary: ₹1,10,000 per month)
Resume Tip
Resume tip

Tip 1: Make sure you do not include projects in your resume that can be easily created by an LLM in one or two prompts.

Tip 2: Even if you have clone-type projects, ensure that you have added some unique features to them.

Interview rounds

01
Round
Medium
Online Coding Interview
Duration70 minutes
Interview date2 Oct 2025
Coding problem2

It was an on-campus opportunity. The OA was conducted in the classroom.

1. Encoded Message Frequency

Moderate
0/80
Asked in company
Amazon

You are given a string encoded with a special algorithm. Your task is to decode the string and count the frequency of each letter from 'A' to 'Z' in the final decoded message.


The encoding rules are as follows:

  • Single-Digit Characters: The letters 'A' through 'I' are represented by the digits 1 through 9 respectively.
  • Double-Digit Characters: The letters 'J' through 'Z' are represented by two digits (10 through 26) followed by a # symbol. For example, 10# is 'J', 11# is 'K', and so on.
  • Repetition: A character or character sequence can be followed by a repetition marker in the format [k], where k is an integer. This means the character decoded just before the [ appears k times. For example, 1[3] decodes to three 'A's, and 12#[2] decodes to two 'L's.

    Your function should not return the full decoded string (which could be very long). Instead, it must return an array or list of 26 integers, where the element at index 0 is the frequency of 'A', at index 1 is the frequency of 'B', and so on.


Problem approach

Initially, I solved it in a straightforward way by fully decoding the entire string. I iterated through the encoded string and identified whether the current part represented a single-digit number or a two-digit number followed by 'x'.

I then converted that number into the corresponding character. If there was a [k] after it, I repeated that character k times. I kept appending all decoded characters to a new string.

Once I had the fully decoded string, I counted the frequency of each character using an array of size 26.

All the test cases passed (15/15).

Try solving now

2. Minimum Cost to Connect Network

Hard
0/120
Asked in company
Amazon

You are the network administrator for a campus with n buildings. A set of cables originally connected all buildings, forming a single connected network. Unfortunately, due to some damage, some of these cables are now broken.


You are given:

  • n: The number of buildings (nodes), numbered 1 to n.
  • edges: A list of all cables that are currently working.
  • broken_edges: A separate list of the broken cables, along with the cost to repair each one.


Your task is to determine the minimum total cost to repair a selection of broken cables so that all n buildings are once again part of a single, fully connected network.


If it's impossible to connect all buildings even after repairing all broken cables, you should report it.


Problem approach

At first, I thought of trying all possible combinations of broken edges.

The idea was to try different subsets of edges to repair. For each subset, I would check if the graph becomes fully connected. If it did, I would calculate the total repair cost and take the minimum among all such valid combinations. To check connectivity, I used BFS each time.

This was a brute-force approach, and I could not solve it optimally. It passed only 5 out of 15 test cases.

Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date8 Oct 2025
Coding problem2

It was an online round conducted on the Chime platform. There were two interviewers, but only one interviewer asked the questions.

1. Maximum width of a Binary Tree

Easy
15m average time
80% success
0/40
Asked in companies
HSBCAmazonCTS

You are given an arbitrary binary tree consisting of N nodes, where each node is associated with a certain value, your task is to find the maximum width of the given tree.

Width of a binary tree is defined as the maximum width of all levels.

For example, consider the following binary tree: example

For the above tree, width of level 1 is 1, width of level 2 is 2, width of level 3 is 3 and width of level 4 is 1. So the maximum width of the tree is 3.

Problem approach

I solved this problem by performing a level-order traversal of the tree and using indexing to track each node’s position. The idea was to treat the tree as a complete binary tree, where the root is at index 0, and for any node at index i, its left and right children are at indices 2i + 1 and 2i + 2, respectively.

During the level-order traversal, I kept track of both the node and its index in the queue. For each level, I recorded the indices of the first and last nodes and calculated the width as (last − first + 1). To avoid integer overflow due to large indices at deeper levels, I normalized the indices at each level by subtracting the smallest index of that level from all indices in that level.

Although I solved the problem correctly, it took me a considerable amount of time to implement. The interviewer was initially happy with my approach, but it took me around 40 minutes to write the code correctly while handling all edge cases.

Try solving now

2. House Robber II

Moderate
15m average time
80% success
0/80
Asked in companies
SamsungUberOptum

Mr. X is a professional robber planning to rob houses along a street. Each house has a certain amount of money hidden.


All houses along this street are arranged in a circle. That means the first house is the neighbour of the last one. Meanwhile, adjacent houses have a security system connected, and it will automatically contact the police if two adjacent houses are broken into on the same night.


You are given an array/list of non-negative integers 'ARR' representing the amount of money of each house. Your task is to return the maximum amount of money Mr. X can rob tonight without alerting the police.


Note:
It is possible for Mr. X to rob the same amount of money by looting two different sets of houses. Just print the maximum possible robbed amount, irrespective of sets of houses robbed.


For example:
(i) Given the input array arr[] = {2, 3, 2} the output will be 3 because Mr X cannot rob house 1 (money = 2) and then rob house 3 (money = 2), because they are adjacent houses. So, he’ll rob only house 2 (money = 3)

(ii) Given the input array arr[] = {1, 2, 3, 1} the output will be 4 because Mr X rob house 1 (money = 1) and then rob house 3 (money = 3).

(iii) Given the input array arr[] = {0} the output will be 0 because Mr. X has got nothing to rob.
Problem approach

Christmas gifts were arranged in a circle, which means the first and last gifts are adjacent, so the robber cannot pick both of them together.

To handle this circular constraint, I broke the problem into two simpler linear cases. In the first case, I considered robbing from the second gift to the last one (ignoring the first gift). In the second case, I considered robbing from the first gift to the second-to-last one (ignoring the last gift). This way, I avoided the conflict between the first and last gifts. I then took the maximum result from these two cases.

To solve each of these linear cases, I used a dynamic programming approach with space optimization. Instead of using a DP array, I kept track of only two variables: one representing the maximum loot up to the previous position, and another for the position before that. For each gift, I decided whether to pick it (adding its value to the result from two steps back) or skip it (carrying forward the previous result). I took the maximum of these two choices and updated the variables accordingly.

Although I was able to write the solution correctly, the interviewer was not able to understand my code, and I could not explain it clearly. This may have been the reason I got rejected.

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

Which data structure is used to implement a DFS?

Choose another skill to practice
Similar interview experiences
company logo
SDE - Intern
3 rounds | 3 problems
Interviewed by Amazon
2194 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 7 problems
Interviewed by Amazon
1086 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 3 problems
Interviewed by Amazon
1077 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3586 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - Intern
4 rounds | 7 problems
Interviewed by Microsoft
15563 views
1 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 6 problems
Interviewed by Microsoft
8210 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Microsoft
4939 views
2 comments
0 upvotes