Amazon Onsite DSA Round

Posted
23 Jul 2025
274 reads

Summary

I was asked two Data Structures and Algorithms questions during my onsite round at Amazon.

How it went

Two questions were asked

Question 1 Given an array and an integer x. You can remove one element either from left end or right end and subtract that number from x. Removal of element from left or right end is considered as one operation. You have to return minimum number of operations to make x = 0.

Question 2 There is an array of binary integer initially all 0. In each iteration all the multiple of that iteration number will be toggled like if it is 0 then it will become 1 and vice versa.

1st iteration all will be toggled to 1 2nd all multiples of 2 will be toggled. 3rd iteration all multiples of 3 will be toggled. so on.

At the end return all the indexes which is 1

Questions asked (2)

  1. 01

    Minimum Operations to Make X Zero by Removing Ends

    Data Structures & Algorithms

    Given an array and an integer x. You can remove one element either from left end or right end and subtract that number from x. Removal of element from left or right end is considered as one operation. You have to return minimum number of operations to make x = 0.

  2. 02

    Toggle Multiples in Binary Array

    Data Structures & Algorithms

    There is an array of binary integer initially all 0. In each iteration all the multiple of that iteration number will be toggled like if it is 0 then it will become 1 and vice versa.

    1st iteration all will be toggled to 1 2nd all multiples of 2 will be toggled. 3rd iteration all multiples of 3 will be toggled. so on.

    At the end return all the indexes which is 1

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Amazon recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!