Amazon OA problems SDE Intern (India) - July 2025

amazon logo
amazon
SDE InternIndia
July 5, 20253 reads

Summary

I successfully solved two coding problems during my Amazon SDE Intern Online Assessment for July 2025, which also included behavioral and aptitude questions.

Full Experience

Problem 1

You are given an array sequenceData of length n, where each element is a positive integer.

You can perform the following operation any number of times (including zero):

Choose a prefix of the array (the first s elements where 1 ≤ s ≤ n) that contains no zeros, and Decrease every element in that prefix by 1.

Your task is to perform any sequence of such operations to maximize the number of zeros in the array.

Return the maximum number of zeros that can be achieved.


Problem 2

You are given an array items of length n, where items[i] represents the number of items in the i-th storage bin.

You can perform the following operation any number of times:

Choose the bin with the maximum number of items (if multiple, pick any), Remove 1 item from it and add it to the bin with the minimum number of items (if multiple, pick any).

Your goal is to perform such operations until the difference between any two bins is at most 1.

Return the minimum number of operations required to achieve this balanced state.


SOLVED both of them

The test also included lot of behavorial and aptitiude based questions.

Interview Questions (2)

Q1
Maximize Zeros in Array by Prefix Decrement
Data Structures & Algorithms

You are given an array sequenceData of length n, where each element is a positive integer.

You can perform the following operation any number of times (including zero):

Choose a prefix of the array (the first s elements where 1 ≤ s ≤ n) that contains no zeros, and Decrease every element in that prefix by 1.

Your task is to perform any sequence of such operations to maximize the number of zeros in the array.

Return the maximum number of zeros that can be achieved.

Q2
Balance Storage Bins with Minimum Operations
Data Structures & Algorithms

You are given an array items of length n, where items[i] represents the number of items in the i-th storage bin.

You can perform the following operation any number of times:

Choose the bin with the maximum number of items (if multiple, pick any), Remove 1 item from it and add it to the bin with the minimum number of items (if multiple, pick any).

Your goal is to perform such operations until the difference between any two bins is at most 1.

Return the minimum number of operations required to achieve this balanced state.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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