Amazon Coding Interview Questions for SDE

Amazon Coding Interview Questions for SDE

After discussing with HR, she scheduled an interview for the first round. This recruitment is for the Amazon SDE-2 (Software Developer Engineer 2). Usually, you should have 4-8 years of experience for the Amazon SDE-2 role.

Here is my Amazon interview experience.

Amazon Coding Interview Questions for SDE

Amazon has its own hosting platform to host the interview. They will share the link to join a couple of days before the interview.

I join the interview call and there was a single interviewer. He asked me to turn on the camera.

The interview starts with our introduction. We introduce each other. Then he asks me one question.

What is the one instance in your career where you face challenges and what was your learning from it?

Just be ready for some similar questions to answer. They can also ask you some behavioral questions.

After that, we shared the common screen and he asked me two coding questions that I remember.

Question 1

Question 1:

Create an Immutable Stack.


S1 - 4

S2 - 
8
4

s2.push(12)

S3
12
8
4



Aim: Design such Immutable stack while using as less space as possible.

Condition: Every time when you do the push() or pop() operation on the stack it should create a new stack instance, leaving the old stack as it is. So that, the user can access the old as well as new stack.

Answer:

You don’t need to write the executable code. Think about the solution and explain it with the pseudo-code.

Hope you are familiar with the basic stack operations.

For every pop() or push() operations new stack is getting created. It will occupy a certain space. Here you have to suggest an efficient approach to utilize the minimum space.

A probable solution to this problem is that, when you do the push operation, a new stack is getting created. The new stack will also have all the elements from the previous stack and one newly added element. So instead of saving all the elements in the new stack, save the reference of the previous stack in the new stack and one newly added element. This way, we are not copying the same elements to the new stack and it saves a lot of space.

Question 2

Minimum Cost to Paint all Houses with No Adjacent Houses Have the Same Color

Note: As this is the proper coding question, it is expected that you should write the executable code for this coding problem. You can choose any programming language of your choices like C/C++, Java, or Python.

If you crack this round, you will be asked for the system design and other technical rounds.

Take away

This is the latest Amazon coding interview questions for SDE asked in 2023. If you have any questions, ask me in the comment section below.

All the best!


Editors’ Note: This experience and Amazon coding interview questions for SDE are shared by the candidate Nutan R. We wish her all the best for her future.

Leave a Reply

Your email address will not be published. Required fields are marked *